parent
0d5d465d59
commit
53dd4b4a16
13 changed files with 612 additions and 976 deletions
@ -0,0 +1,70 @@ |
||||
[ |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 1, |
||||
"fields": { |
||||
"create_at": "2018-08-12T19:23:11.150Z", |
||||
"updated_at": "2018-08-12T19:23:33.159Z", |
||||
"name": "Microsoft", |
||||
"slug": "windows", |
||||
"parent": null, |
||||
"image": "products/windows/windows.svg", |
||||
"status": 25, |
||||
"lft": 1, |
||||
"rght": 2, |
||||
"tree_id": 1, |
||||
"level": 0 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 2, |
||||
"fields": { |
||||
"create_at": "2018-08-12T19:23:49.581Z", |
||||
"updated_at": "2018-08-12T19:23:49.581Z", |
||||
"name": "\u0410\u043d\u0442\u0438\u0432\u0438\u0440\u0443\u0441", |
||||
"slug": "antivirus", |
||||
"parent": null, |
||||
"image": "products/antivirus/antivirus_oDon9N3.svg", |
||||
"status": 25, |
||||
"lft": 1, |
||||
"rght": 2, |
||||
"tree_id": 2, |
||||
"level": 0 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 3, |
||||
"fields": { |
||||
"create_at": "2018-08-12T19:23:59.394Z", |
||||
"updated_at": "2018-08-12T19:23:59.394Z", |
||||
"name": "\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f", |
||||
"slug": "virtualizatsiya", |
||||
"parent": null, |
||||
"image": "products/virtualizatsiya/virtualization_tEnq2Bu.svg", |
||||
"status": 25, |
||||
"lft": 1, |
||||
"rght": 4, |
||||
"tree_id": 3, |
||||
"level": 0 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 4, |
||||
"fields": { |
||||
"create_at": "2018-08-12T20:05:06.726Z", |
||||
"updated_at": "2018-08-12T20:05:06.726Z", |
||||
"name": "Oracle", |
||||
"slug": "oracle", |
||||
"parent": 3, |
||||
"image": "", |
||||
"status": 25, |
||||
"lft": 2, |
||||
"rght": 3, |
||||
"tree_id": 3, |
||||
"level": 1 |
||||
} |
||||
} |
||||
] |
||||
@ -0,0 +1 @@ |
||||
[{"model": "products.manufacturer", "pk": 1, "fields": {"create_at": "2018-08-12T19:24:12.126Z", "updated_at": "2018-08-12T19:24:12.126Z", "name": "Microsoft", "slug": "microsoft", "image": "", "status": 25}}, {"model": "products.manufacturer", "pk": 2, "fields": {"create_at": "2018-08-12T19:24:18.725Z", "updated_at": "2018-08-12T19:24:18.725Z", "name": "Parallels", "slug": "parallels", "image": "", "status": 25}}, {"model": "products.manufacturer", "pk": 3, "fields": {"create_at": "2018-08-12T19:24:31.655Z", "updated_at": "2018-08-12T19:24:31.655Z", "name": "Eset", "slug": "eset", "image": "", "status": 25}}] |
||||
@ -1,533 +0,0 @@ |
||||
[ |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 1, |
||||
"fields": { |
||||
"name": "Information security", |
||||
"slug": "information-security", |
||||
"is_active": true, |
||||
"parent": null, |
||||
"lft": 1, |
||||
"rght": 6, |
||||
"tree_id": 2, |
||||
"level": 0 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 2, |
||||
"fields": { |
||||
"name": "Document manipulation", |
||||
"slug": "document-manipulation", |
||||
"is_active": true, |
||||
"parent": null, |
||||
"lft": 1, |
||||
"rght": 4, |
||||
"tree_id": 1, |
||||
"level": 0 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 3, |
||||
"fields": { |
||||
"name": "System software", |
||||
"slug": "system-software", |
||||
"is_active": true, |
||||
"parent": null, |
||||
"lft": 1, |
||||
"rght": 6, |
||||
"tree_id": 3, |
||||
"level": 0 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 4, |
||||
"fields": { |
||||
"name": "Anti-virus software", |
||||
"slug": "anti-virus-software", |
||||
"is_active": true, |
||||
"parent": 1, |
||||
"lft": 2, |
||||
"rght": 3, |
||||
"tree_id": 2, |
||||
"level": 1 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 5, |
||||
"fields": { |
||||
"name": "Data recovery", |
||||
"slug": "data-recovery", |
||||
"is_active": true, |
||||
"parent": 1, |
||||
"lft": 4, |
||||
"rght": 5, |
||||
"tree_id": 2, |
||||
"level": 1 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 6, |
||||
"fields": { |
||||
"name": "OS", |
||||
"slug": "os", |
||||
"is_active": true, |
||||
"parent": 3, |
||||
"lft": 4, |
||||
"rght": 5, |
||||
"tree_id": 3, |
||||
"level": 1 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 7, |
||||
"fields": { |
||||
"name": "DB", |
||||
"slug": "db", |
||||
"is_active": true, |
||||
"parent": 3, |
||||
"lft": 2, |
||||
"rght": 3, |
||||
"tree_id": 3, |
||||
"level": 1 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productcategory", |
||||
"pk": 8, |
||||
"fields": { |
||||
"name": "Microsoft Office", |
||||
"slug": "microsoft-office", |
||||
"is_active": true, |
||||
"parent": 2, |
||||
"lft": 2, |
||||
"rght": 3, |
||||
"tree_id": 1, |
||||
"level": 1 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productattribute", |
||||
"pk": 1, |
||||
"fields": { |
||||
"name": "License type", |
||||
"slug": "license-type" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productattribute", |
||||
"pk": 2, |
||||
"fields": { |
||||
"name": "License term", |
||||
"slug": "license-term" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productattribute", |
||||
"pk": 3, |
||||
"fields": { |
||||
"name": "Technical support", |
||||
"slug": "technical-support" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productattribute", |
||||
"pk": 4, |
||||
"fields": { |
||||
"name": "Number users", |
||||
"slug": "number-users" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productattribute", |
||||
"pk": 5, |
||||
"fields": { |
||||
"name": "Type of organization", |
||||
"slug": "type-organization" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 1, |
||||
"fields": { |
||||
"name": "New", |
||||
"slug": "new", |
||||
"attribute": 1 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 2, |
||||
"fields": { |
||||
"name": "Prolongation", |
||||
"slug": "prolongation", |
||||
"attribute": 1 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 3, |
||||
"fields": { |
||||
"name": "Migration", |
||||
"slug": "migration", |
||||
"attribute": 1 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 4, |
||||
"fields": { |
||||
"name": "One year", |
||||
"slug": "one-year", |
||||
"attribute": 2 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 5, |
||||
"fields": { |
||||
"name": "Two years", |
||||
"slug": "two-years", |
||||
"attribute": 2 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 6, |
||||
"fields": { |
||||
"name": "Standard AAS", |
||||
"slug": "standard-aas", |
||||
"attribute": 3 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 7, |
||||
"fields": { |
||||
"name": "Extended AAP", |
||||
"slug": "extended-aap", |
||||
"attribute": 3 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 8, |
||||
"fields": { |
||||
"name": "from 1 to 49", |
||||
"slug": "1-49", |
||||
"attribute": 4 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 9, |
||||
"fields": { |
||||
"name": "from 50 to 99", |
||||
"slug": "50-99", |
||||
"attribute": 4 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 10, |
||||
"fields": { |
||||
"name": "from 100 to 299", |
||||
"slug": "100-299", |
||||
"attribute": 4 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 11, |
||||
"fields": { |
||||
"name": "Version Upgrade", |
||||
"slug": "version-upgrade", |
||||
"attribute": 1 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 12, |
||||
"fields": { |
||||
"name": "commercial", |
||||
"slug": "commercial", |
||||
"attribute": 5 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.attributechoicevalue", |
||||
"pk": 13, |
||||
"fields": { |
||||
"name": "educational", |
||||
"slug": "educational", |
||||
"attribute": 5 |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productclass", |
||||
"pk": 1, |
||||
"fields": { |
||||
"name": "Antivirus software class", |
||||
"has_variants": true, |
||||
"variant_attributes": [ |
||||
2, |
||||
1, |
||||
5 |
||||
] |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productclass", |
||||
"pk": 2, |
||||
"fields": { |
||||
"name": "Data recovery class", |
||||
"has_variants": true, |
||||
"variant_attributes": [ |
||||
1, |
||||
3 |
||||
] |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productclass", |
||||
"pk": 3, |
||||
"fields": { |
||||
"name": "Document manipulation class", |
||||
"has_variants": true, |
||||
"variant_attributes": [] |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productclass", |
||||
"pk": 4, |
||||
"fields": { |
||||
"name": "DB class", |
||||
"has_variants": true, |
||||
"variant_attributes": [ |
||||
2, |
||||
4 |
||||
] |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.productclass", |
||||
"pk": 5, |
||||
"fields": { |
||||
"name": "OS class", |
||||
"has_variants": true, |
||||
"variant_attributes": [ |
||||
5 |
||||
] |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.product", |
||||
"pk": 85, |
||||
"fields": { |
||||
"name": "Kaspersky Endpoint Security \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430 CLOUD", |
||||
"slug": "kaspersky-endpoint-security-dlya-biznesa-cloud", |
||||
"price": "1730.00", |
||||
"points": "173.00", |
||||
"description": "Kaspersky Endpoint Security Cloud \u2013 \u044d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044f\u043c \u043c\u0430\u043b\u043e\u0433\u043e \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043d\u0430\u0434\u0435\u0436\u043d\u0443\u044e \u0437\u0430\u0449\u0438\u0442\u0443 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043e\u0432, \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0438\u0437 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043a \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0443.", |
||||
"short_description": "", |
||||
"producer": "Kaspersky", |
||||
"image": "products/2017/05/26/thumb_1473758588.png", |
||||
"discount": 0, |
||||
"stock": 10, |
||||
"category": 4, |
||||
"product_class": 1, |
||||
"is_active": true, |
||||
"is_hit": false, |
||||
"is_new": false, |
||||
"created": "2017-05-26", |
||||
"updated": "2017-07-07" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.product", |
||||
"pk": 86, |
||||
"fields": { |
||||
"name": "ESET NOD32 Antivirus Business Edition", |
||||
"slug": "eset-nod32-antivirus-business-edition", |
||||
"price": "2400.00", |
||||
"points": "240.00", |
||||
"description": "ESET Endpoint Antivirus \u2013 \u043d\u043e\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u0432 \u043f\u0440\u043e\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0437\u0430\u0449\u0438\u0442\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0445 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0441\u0442\u0430\u043d\u0446\u0438\u0439 \u043e\u0442 \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u043e\u0434\u0443\u043a\u0442 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0437\u0430\u043f\u0440\u0435\u0449\u0435\u043d\u043d\u044b\u0445 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0444\u0438\u0434\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0421\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0430\u0442\u0435\u043d\u0442\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u043d\u043e\u0432\u0435\u0439\u0448\u0438\u0445 \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0443\u0433\u0440\u043e\u0437, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044f \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u043e\u0433\u043e \u041f\u041e \u0432 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0441\u0435\u0442\u044c.", |
||||
"short_description": "", |
||||
"producer": "Eset", |
||||
"image": "products/2017/05/26/thumb_1381486034.jpg", |
||||
"discount": 0, |
||||
"stock": 10, |
||||
"category": 4, |
||||
"product_class": 1, |
||||
"is_active": true, |
||||
"is_hit": false, |
||||
"is_new": false, |
||||
"created": "2017-05-26", |
||||
"updated": "2017-07-07" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.product", |
||||
"pk": 87, |
||||
"fields": { |
||||
"name": "Acronis Backup 12 Workstation License", |
||||
"slug": "acronis-backup-12-workstation-license", |
||||
"price": "3190.00", |
||||
"points": "319.00", |
||||
"description": "\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438\r\n\r\n\u0411\u044b\u0441\u0442\u0440\u043e\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0434\u0430\u043d\u043d\u044b\u0445\r\n\r\n \u0411\u044b\u0441\u0442\u0440\u043e\u0435 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 \u0434\u0438\u0441\u043a\u0430\r\n \u0423\u0434\u043e\u0431\u043d\u043e\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \"\u043d\u0430 \u0433\u043e\u043b\u043e\u0435 \u0436\u0435\u043b\u0435\u0437\u043e\" \u043d\u0430 \u0442\u043e\u043c \u0436\u0435 \u0438\u043b\u0438 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0449\u0435\u043c\u0441\u044f \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0438, \u043b\u0438\u0431\u043e \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435\r\n \u0420\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u043f\u043e\u043a \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0438\u043b\u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043f\u0430\u043f\u043e\u043a \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f\r\n \u0412\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043f\u0430\u043f\u043e\u043a \u0438\u0437 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0439 \u043a\u043e\u043f\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043e\u0431\u0440\u0430\u0437\u0430\r\n \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0445 \u043a\u043e\u043f\u0438\u0439 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d", |
||||
"short_description": "", |
||||
"producer": "Acronis", |
||||
"image": "products/2017/05/26/thumb_1384933473.jpg", |
||||
"discount": 0, |
||||
"stock": 10, |
||||
"category": 5, |
||||
"product_class": 2, |
||||
"is_active": true, |
||||
"is_hit": false, |
||||
"is_new": false, |
||||
"created": "2017-05-26", |
||||
"updated": "2017-07-07" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.product", |
||||
"pk": 88, |
||||
"fields": { |
||||
"name": "Symantec System Recovery Desktop", |
||||
"slug": "symantec-system-recovery-desktop", |
||||
"price": "3830.00", |
||||
"points": "383.00", |
||||
"description": "Symantec System Recovery 2013 \u2013 \u044d\u0442\u043e \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u044b\u0445 \u043a\u043e\u043f\u0438\u0439 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0441\u0442\u0430\u043d\u0446\u0438\u0439 \u0438 \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u043e\u0432 \u0432 \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u044f \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u0437\u0430\u0434\u0430\u0447.\r\n\r\n\u0422\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f Restore Anyware, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0432 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0435, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u043c \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0435\u0448\u0430\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441 \u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0442\u043e\u0433\u043e, \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e, \u0432 \u043d\u0443\u0436\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0438 \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u0414\u0430\u043d\u043d\u0430\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u044b, \u043f\u0430\u043f\u043a\u0438 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043d\u043e \u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0446\u0435\u043b\u0438\u043a\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0438\u043b\u0438 \u043d\u043e\u0432\u043e\u0435 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0435.", |
||||
"short_description": "", |
||||
"producer": "Symantec", |
||||
"image": "products/2017/05/26/thumb_1401701995.png", |
||||
"discount": 0, |
||||
"stock": 5, |
||||
"category": 5, |
||||
"product_class": 2, |
||||
"is_active": true, |
||||
"is_hit": false, |
||||
"is_new": false, |
||||
"created": "2017-05-26", |
||||
"updated": "2017-07-07" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.product", |
||||
"pk": 89, |
||||
"fields": { |
||||
"name": "Microsoft Windows 10 Professional GetGenuine", |
||||
"slug": "microsoft-windows-10-professional-getgenuine", |
||||
"price": "12300.00", |
||||
"points": "1230.00", |
||||
"description": "Get Gunuine Windows Agreement GGWA \u2013 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043b\u044f \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043f\u0438\u0439 \u041e\u0421 Windows, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0440\u0430\u043d\u0435\u0435 \u0431\u0435\u0437 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0438. \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043e\u0442 5 \u0438 \u0431\u043e\u043b\u0435\u0435 \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0439 \u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043d\u0430 \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.", |
||||
"short_description": "", |
||||
"producer": "Microsoft", |
||||
"image": "products/2017/05/26/thumb_1438765887.jpg", |
||||
"discount": 0, |
||||
"stock": 2, |
||||
"category": 6, |
||||
"product_class": 5, |
||||
"is_active": true, |
||||
"is_hit": false, |
||||
"is_new": false, |
||||
"created": "2017-05-26", |
||||
"updated": "2017-07-07" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.product", |
||||
"pk": 90, |
||||
"fields": { |
||||
"name": "PERFEXPERT", |
||||
"slug": "perfexpert", |
||||
"price": "50000.00", |
||||
"points": "5000.00", |
||||
"description": "\u041a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f, \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 24\u04257. \u041e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u043c\u0438 \u0438\u043d\u0446\u0438\u0434\u0435\u043d\u0442\u0430\u043c\u0438 \u0431\u0438\u0437\u043d\u0435\u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u044f\u0442\u0438\u044f, \u0438 \u0442\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. PERFEXPERT \u043d\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.", |
||||
"short_description": "", |
||||
"producer": "SOFTPOINT", |
||||
"image": "products/2017/05/26/thumb_1424247372.png", |
||||
"discount": 0, |
||||
"stock": 5, |
||||
"category": 7, |
||||
"product_class": 4, |
||||
"is_active": true, |
||||
"is_hit": false, |
||||
"is_new": false, |
||||
"created": "2017-05-26", |
||||
"updated": "2017-07-07" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.product", |
||||
"pk": 91, |
||||
"fields": { |
||||
"name": "Office 365 Business Open", |
||||
"slug": "office-365-business-open", |
||||
"price": "5700.00", |
||||
"points": "570.00", |
||||
"description": "\u041f\u043b\u0430\u043d Office 365 \u0411\u0438\u0437\u043d\u0435\u0441 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438 \u0446\u0435\u043d\u043e\u0432\u044b\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u044b, \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u043b\u043e\u0433\u043e \u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u2013 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043e\u0442 1 \u0434\u043e 300 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432.", |
||||
"short_description": "", |
||||
"producer": "Microsoft", |
||||
"image": "products/2017/05/26/office.png", |
||||
"discount": 5, |
||||
"stock": 13, |
||||
"category": 8, |
||||
"product_class": 3, |
||||
"is_active": true, |
||||
"is_hit": false, |
||||
"is_new": false, |
||||
"created": "2017-05-26", |
||||
"updated": "2017-07-07" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.offer", |
||||
"pk": 30, |
||||
"fields": { |
||||
"product": 85, |
||||
"name": "Kaspersky-New-One-year", |
||||
"price": "1730.00", |
||||
"points": "0.00", |
||||
"attributes": "{\"License type\": \"New\", \"License term\": \"One year\"}" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.offer", |
||||
"pk": 31, |
||||
"fields": { |
||||
"product": 85, |
||||
"name": "Kaspersky-New-One-year", |
||||
"price": "2600.00", |
||||
"points": "0.00", |
||||
"attributes": "{\"License type\": \"New\", \"License term\": \"Two years\"}" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.offer", |
||||
"pk": 32, |
||||
"fields": { |
||||
"product": 85, |
||||
"name": "Kaspersky-Prolongation-One-year", |
||||
"price": "1200.00", |
||||
"points": "0.00", |
||||
"attributes": "{\"License type\": \"Prolongation\", \"License term\": \"One year\"}" |
||||
} |
||||
}, |
||||
{ |
||||
"model": "products.offer", |
||||
"pk": 33, |
||||
"fields": { |
||||
"product": 85, |
||||
"name": "Kaspersky-Migration-One-year", |
||||
"price": "1900.00", |
||||
"points": "0.00", |
||||
"attributes": "{\"License type\": \"Migration\", \"License term\": \"One year\"}" |
||||
} |
||||
} |
||||
] |
||||
@ -1,68 +1,128 @@ |
||||
# from haystack.forms import FacetedSearchForm |
||||
|
||||
|
||||
# class FacetedProductSearchForm(FacetedSearchForm): |
||||
# def __init__(self, *args, **kwargs): |
||||
# data = dict(kwargs.get("data", [])) |
||||
# self.categories = data.get('category', []) |
||||
# self.producers = data.get('producer', []) |
||||
# super(FacetedProductSearchForm, self).__init__(*args, **kwargs) |
||||
# |
||||
# def search(self): |
||||
# sqs = super(FacetedProductSearchForm, self).search() |
||||
# if self.categories: |
||||
# query = None |
||||
# for category in self.categories: |
||||
# if query: |
||||
# query += u' OR ' |
||||
# else: |
||||
# query = u'' |
||||
# query += u'"%s"' % sqs.query.clean(category) |
||||
# sqs = sqs.narrow(u'category_exact:%s' % query) |
||||
# if self.producers: |
||||
# query = None |
||||
# for producer in self.producers: |
||||
# if query: |
||||
# query += u' OR ' |
||||
# else: |
||||
# query = u'' |
||||
# query += u'"%s"' % sqs.query.clean(producer) |
||||
# sqs = sqs.narrow(u'brand_exact:%s' % query) |
||||
# return sqs |
||||
from crispy_forms.layout import Layout, Field, Button |
||||
from ckeditor.widgets import CKEditorWidget |
||||
from crispy_forms.layout import Layout, Field, Button, Div, HTML |
||||
from django import forms |
||||
from crispy_forms.helper import FormHelper |
||||
from django.forms import formset_factory |
||||
from django.forms import ALL_FIELDS |
||||
from django.urls import reverse_lazy |
||||
from django.utils.translation import ugettext_lazy as _ |
||||
|
||||
from .models import Product, ProductAttribute |
||||
from core.forms import QueryFormBase |
||||
from core.utils import parse_path |
||||
from products.templatetags.products_filters import apply_query_params |
||||
from .models import Product, Manufacturer |
||||
|
||||
|
||||
class ProductFilterForm(forms.Form): |
||||
def __init__(self, *args,**kwargs): |
||||
super().__init__(*args,**kwargs) |
||||
|
||||
|
||||
class ProductSearchForm(forms.ModelForm): |
||||
class ProductSearchForm(QueryFormBase, forms.ModelForm): |
||||
field_template = 'bootstrap/forms/product_search.html' |
||||
form_action = 'products:product_list' |
||||
submit_css_class = None |
||||
|
||||
def __init__(self, *args, **kwargs): |
||||
self.submit_css_class = kwargs.pop('submit_css_class') |
||||
|
||||
self.helper = FormHelper() |
||||
self.helper.form_action = reverse_lazy(self.form_action) |
||||
self.helper.form_method = 'get' |
||||
self.helper.layout = Layout( |
||||
Field('name', template=self.field_template, placeholder="Поиск программы..."), |
||||
Button(_('search'),value="search", css_class=self.submit_css_class, template=self.field_template) |
||||
Button(_('search'), value="search", css_class=self.submit_css_class, template=self.field_template) |
||||
) |
||||
super().__init__(*args, **kwargs) |
||||
|
||||
self.helper.form_action = reverse_lazy(**self.form_action) + apply_query_params( |
||||
self.query_params) if self.query_params else "" |
||||
|
||||
class Meta: |
||||
model = Product |
||||
fields = ['name'] |
||||
fields = ('name',) |
||||
|
||||
|
||||
# --------------------------- Product Filter Types -------------------------# |
||||
class ProductManufacturerFilterForm(QueryFormBase): |
||||
manufacturer = forms.ChoiceField() |
||||
|
||||
submit_css_button = None |
||||
field_template = 'bootstrap/forms/product_filter.html' |
||||
title = _('Производитель') |
||||
|
||||
def __init__(self, *args, **kwargs): |
||||
self.helper = FormHelper() |
||||
self.helper.form_method = 'get' |
||||
self.helper.layout = Layout( |
||||
Div(HTML(self.title), css_class='category__title'), |
||||
Field('manufacturer', template=self.field_template) |
||||
) |
||||
super().__init__(*args, **kwargs) |
||||
|
||||
self.helper.form_action = self.get_form_action_url() |
||||
|
||||
def get_initial_for_field(self, field, field_name): |
||||
if field_name == 'manufacturer': |
||||
man_qs = Manufacturer.active |
||||
category_instance = '' |
||||
if self.form_action.get('kwargs', None): |
||||
category_instance = parse_path(self.form_action.get('kwargs').get('path', '')) |
||||
|
||||
prod_qs = Product.active.filter( |
||||
parent__name=category_instance, |
||||
name__icontains=self.query_params.get('name', '') |
||||
).only('pk') |
||||
|
||||
if prod_qs.count(): |
||||
man_qs = man_qs.filter(product__pk__in=prod_qs.all()) |
||||
|
||||
return man_qs.distinct('name').only('name', 'slug') |
||||
return super().get_initial_for_field(field, field_name) |
||||
|
||||
|
||||
inline_product_filter_formset = formset_factory(ProductFilterForm,extra=ProductAttribute.objects.all(),can_order=True,can_delete=False) |
||||
class ProductSortForm(QueryFormBase): |
||||
submit_css_button = None |
||||
field_template = 'bootstrap/forms/product_sorting.html' |
||||
title = _('Сортировать по') |
||||
sort_fields = { |
||||
'price': _('Цене'), |
||||
'popular': _('Популярности'), |
||||
'rate': _('Рейтингу') |
||||
} |
||||
sort = forms.ChoiceField(label=title) |
||||
|
||||
def __init__(self, *args, **kwargs): |
||||
self.helper = FormHelper() |
||||
self.helper.form_method = 'get' |
||||
self.helper.layout = Layout( |
||||
HTML(self.title), |
||||
Field('sort', template=self.field_template) |
||||
) |
||||
super().__init__(*args, **kwargs) |
||||
|
||||
self.helper.form_action = self.get_form_action_url() |
||||
|
||||
def get_sort_field_initial_data(self): |
||||
query_keys = self.query_params.keys() |
||||
initial_data = [] |
||||
for key in self.sort_fields: |
||||
order = "DESC" if key in query_keys else "ASC" |
||||
initial_data.append({ |
||||
'value': "{url}?{query_params}".format(**{ |
||||
'url': reverse_lazy(**self.form_action), |
||||
'query_params': apply_query_params({key: order, **self.query_params}, True) |
||||
}), |
||||
'name': self.sort_fields[key] |
||||
}) |
||||
return initial_data |
||||
|
||||
def get_initial_for_field(self, field, field_name): |
||||
if field_name == 'sort': |
||||
return self.get_sort_field_initial_data() |
||||
return super().get_initial_for_field(field, field_name) |
||||
|
||||
|
||||
# ----------------------------------------- Admin forms ------------------------------------# |
||||
|
||||
|
||||
class ProductAdminForm(forms.ModelForm): |
||||
def __init__(self, *args, **kwargs): |
||||
super().__init__(*args, **kwargs) |
||||
self.fields['description'].widget = CKEditorWidget(config_name='awesome_ckeditor') |
||||
|
||||
class Meta: |
||||
model = Product |
||||
fields = ALL_FIELDS |
||||
|
||||
@ -0,0 +1,7 @@ |
||||
from django.template import Library |
||||
from django.utils.translation import ugettext_lazy as _ |
||||
|
||||
|
||||
register = Library() |
||||
|
||||
|
||||
@ -0,0 +1,61 @@ |
||||
from functools import reduce |
||||
from django.utils.translation import ugettext_lazy as _ |
||||
|
||||
from django.template import Library |
||||
|
||||
from cart.forms import CartAddInlineForm |
||||
|
||||
register = Library() |
||||
|
||||
|
||||
@register.filter |
||||
def apply_nds_status(doesNdsInclude): |
||||
return _('Включено') if doesNdsInclude else _('Не включено') |
||||
|
||||
|
||||
@register.filter |
||||
def apply_product_offer_form(product): |
||||
initial = { |
||||
'offer': product.id, |
||||
'amount': 1 |
||||
} |
||||
return CartAddInlineForm(initial=initial) |
||||
|
||||
|
||||
@register.filter |
||||
def apply_query_params(params, doAppend=False): |
||||
""" |
||||
|
||||
:param params dict: |
||||
:param arg return as additional query params or initial: |
||||
:return string: |
||||
""" |
||||
formated_params = "" |
||||
if not params: |
||||
return formated_params |
||||
if doAppend: |
||||
formated_params = "&" + formated_params |
||||
formated_params = reduce( |
||||
lambda q_str, q_key: q_str + "{key}={val}&".format(**{'key': q_key, 'val': params[q_key]}), |
||||
params, |
||||
formated_params |
||||
) |
||||
return formated_params[:-1] |
||||
|
||||
|
||||
@register.filter |
||||
def filter_query_params(params, query_key): |
||||
new_params = {**params} if isinstance(params, dict) else {} |
||||
if query_key in new_params: |
||||
new_params.pop(query_key) |
||||
return new_params |
||||
|
||||
|
||||
@register.filter |
||||
def get_item(dictionary, key): |
||||
return dictionary.get(key) |
||||
|
||||
|
||||
@register.filter |
||||
def apply_desc_preview(description): |
||||
return description |
||||
Loading…
Reference in new issue