Tuesday, July 31, 2012

combobox prepopulated to only related objects to "self"

Hi everyone

i have this model

GROUP and Product


product has a group field thath is foreignkey to GROUP.


and Group has foreignKey to Product to select primary product.

so i want to have a group with many products and one is the "primary product".


so...i could do this by select inline products with "trough" and search an intermediary Model (boolean field).

but it let me select  more than one promary,


the solution is the model this way:.

product has a group field thath is foreignkey to GROUP.


and Group has foreignKey to Product to select primary product.

so i want to have a group with many products and one is the "primary product".

but the primaryproduct field in group will be prepopulated with only the related products to this group.


how i prepopulate the select(combobox) with the reverse query ?






--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/d3UpfhONEWwJ.
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 http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment