forked from belie4u/E-commerce-powered-by-Django-Oscar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_product_attribute.py
51 lines (40 loc) · 959 Bytes
/
create_product_attribute.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from oscar.apps.catalogue.models import *
# create the nmaterial attributes
material = AttributeOptionGroup.objects.create(name='material')
color = AttributeOptionGroup.objects.create(name='color')
# Assign options to material option group
AttributeOption.objects.create(
group= material,
option= 'Steel'
)
AttributeOption.objects.create(
group= material,
option= 'Aluminium'
)
AttributeOption.objects.create(
group= material,
option= 'Thorium'
)
# Assign option to color option group
AttributeOption.objects.create(
group= color,
option= 'Red'
)
AttributeOption.objects.create(
group= color,
option= 'Blue'
)
AttributeOption.objects.create(
group= color,
option= 'Green'
)
AttributeOption.objects.create(
group= color,
option= 'Black'
)
AttributeOption.objects.create(
group= color,
option= 'White'
)
# optional feedback message
print ("AttributeOptionGroup & AttributeOption Added")