I would like to customize behavior of admin inlines interface so when
the editor edit a parent model he is offered with all possible
variations of child objects.

Here is simplified use case:

        class Shirt(models.Model):
            name = models.CharField(max_length=80)

        class Color(models.Model):
            name = models.CharField(max_length=80)

        class ShirtColorPrice(models.Model):
            shirt = models.ForeignKey(Shirt)
            color = models.ForeignKey(Color)
            price = models.DecimalField(max_digits=9, decimal_places=2)

Since there is an limited number of colors, it would be desired that
when editing an Shirt object, editor have all ShirtColorPrice objects
listed as inlines prepopulated with existing colors where he would
write price only for colors that the shirt is available in. When
saving parent object all ShirtColorPrice inlines without price would
be deleted if they existed or not saved at all.

I found this entry (http://stackoverflow.com/questions/442040/pre-
populate-an-inline-formset) which is analogous to my own use case.
Also, I tried to overide and customize InlineModelAdmin interface, but
found that it would take lot of duplication of existing
django.contrib.admin code to get this working inside ModelForm.

One of the possible ways to take is to write admin action that would
handle this case in new page. Before going this way I would like to
know if anyone had similiar needs and what path you choose. Maybe
someone already solved this in open source project or have better
solution for similiar cases?

best,
Bojan

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to