Hello group,
I wanna use the admin interface for manipulating the db-data. I have a
hierarchy of categories and products that shall belong to one or more
categories. Here are the models I currently have:
class Category(models.Model):
name = models.CharField(max_length=30)
parent = models.ForeignKey('self', related_name='child_set')
class Admin:
pass
class Product(models.Model):
name = models.CharField(max_length=30)
categories = models.ManyToManyField('Category',
related_name='product_set')
class Admin:
pass
If I now add a product via the admin interface, I first want to add
the main category of the product, then, after this selection, the next
sub-category depending on this main category shall be chosen - until a
chosen category has an empty child_set. And, like I mentioned, since
products can potentially fit into several categories, it should also
be possible to add more than one category (hence the ManyToManyField).
I have really no idea how I could achieve what I want. Any suggestion
is appreciated.
Regards,
Andreas
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---