On Dec 8, 11:40 pm, Andreas Pfrengle <a.pfren... gmail.com> wrote:
> 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
Well, this issue is still a problem for me. At least I think
now it's
not possible via the admin - or will there be some hooks in
the
newforms-admin to accomplish such things (I'm using trunk)?
Otherwise,
I suppose I'd have to make several forms, a first one that
requests
the main category, then this one is being processed and
gives the
category's child_set as choices for the next form, and so on
until
there is an empty child_set for the category-field. Is this
the way to
go? Or can someone probably point me to an example that
deals with a
similar issue? I couldn't find anything really helpful till
now, even
though I vaguely remember there has been something on this
list some
time ago... somewhere.
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 django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|