Hello. I'd like to try to build a simple (I believe) project with
Django - an Online Store. That is, browseble and manageable catalog of
arbitrary goods.
Here is the draft data models for my project.
* Item. Representation of actual goods. Belong to one of the
Categories. Category defines attributes, which may have values.
As well inherit attributes from all parent categories.
* Category. Hierarchy tree consist of Category entities. Each of
categories can have arbitrary set of Attributes.
* Attribute. Simple attribute of a Category. Defines name and type
(text, int, bool, etc.). Possibly, can be shared between categories.
* AttributeValue. Concrete value of Attribute. Each belong to
individual item.
assumptions:
* Parent attributes should be inherited - that's the nature of
real-world hierarchies.
* Same attributes may be used in different categories not through
inheritance (that is, many to many relationship). For example car
audio and computer parts usually does have a brand, but fruits
usually doesn't.
Example (categories are in '', and attributes are in []):
'root' [name, price]
|-'electronics' [brand]
| |-'car audio'
| | |-'in-dash receivers' [has_removable_panel, plays_mp3]
| | \-'speakers' [power, size]
| \-'portable players' [battery_capacity]
|-'computers' [brand]
| |-'workstations' [cpu, ram, hdd]
| |-'laptops' [battery_capacity, cpu, ram, hdd]
| \-'parts'
\-'books' [publisher, author, pages]
|-'science fiction'
\-'for kids'
E.g. every Item in 'laptops' Category can have unique AttributeValue
for [name, price, brand, battery_capacity, cpu, ram, hdd] Attribute.
My concerns are:
- how to implement attributes hierarchy (inheritance part) with Django
models API?
- Is there a way to use built-in admin interface to manage this data?
- There are maybe flaws in assumptions and/or data models for given
subject. For example I'm not sure if many-to-many relations are best
for attributes - maybe duplicate attributes could be used instead. Or
force user to refactor hierarchy to avoid attribute duplications...
Thanks.
--
serg.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---