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 too The model its something like this: Categories Id_category (PK) CategoryName Category_Parents Id_CategoryParent (PK) Id_Category (fk to Categories.Id_Category) Id_Parent (fk to Categories.Id_Category) 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) Categories_Groups Id_CategoryGroup (PK) Id_Category (fk to Categories.Id_Category) Id_Group (fk to Groups.Id_Groups) InterGroups_Relations Id_InterGroupsRelations InterGroupRelationName Id_Group1 (fk to Groups.Id_Groups) Id_Group2 (fk to Groups.Id_Groups) Id_Relationship (fk to Relationships.Id_Relationship) With this you can add categories, group them and make groups of groups. The elements of a group can have restrictions between them for example the categories of some group can have an xor relation, so only one of them can be choosed for a entity. 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 <deonlinefotogr...@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+unsubscr...@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+unsubscr...@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.