Re: Populate choices from model
I design a model structure to persist restrictions to a selectable category (i dont say that its ok... its for shore that can do a lot of improvements), and make a module to admin categories with that if i choose some category to my contact first i check if i really can add that category to my contact in base of a restriction model.
Let me give you an example... think in contact of a enterprise... supliers, customers, employees... if a contact have employees category he cant have a suplier category tooThe model its something like this:
Categories_Restrictions
Id_CategoryRestriction
Id_CategoryChoosed
Id_CategoryRestricted
Restriction (choice of Y or N)*
*if choose 'Y' means that your entity must already has added a id_categoryRestricted to permit choose id_categoryChoosed
*if choose 'N' means that if your entity has id_CategoryRestricted added you can permit add id_categoryChoosed
Relationships (or use choice of 'and', 'or, 'xor', etc)
Id_Relationship (PK)
RelationshipName
RelationshipDescription
Groups
Id_Groups (PK)
GroupName
Id_Relationship (fk to Relationships.Id_Relationship)
When you choose a Category for your entity first make a check if have some restritction if pass every test then you make add that category.
first check for Categories_Restrictions
then check for groups restrictions
then check for intergroups restrictions
its complicated, i know, also i know that can be better than that... its my little help :P
See ya (sorry my bad english too)
2013/8/21 Gerd Koetje <deonlinefotograaf@gmail.com>
i would vote for the m2m model, but i think i loose it there a bit--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
--
Rafael E. Ferrero
Claro: (03562) 15514856
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home