Django: "reverse" many-to-many relationships on forms -


the easiest example of sort of relationship i'm talking between django's users , groups. user table has manytomany field part of definition , group table "reverse" side.

a note constraints: not working admin interface @ nor option.

now, onto programming problem. need write form used edit mygroup instances, defined following:

class mygroup( group ):   some_field = models.charfield( max_length=50 ) 

i want able have form page can edit both some_field , users members of group. because i'm working model, modelform seems obvious. cannot figure out how django include users because on reverse side of user-group relationship. ideally, i'd display widget specifying users 1 specifying permissions found on user , group pages within admin.

inline-formsets

do trick foreign key relationship.

 groupuserinlineformset = inlineformset_factory(mygroup, user, form=purchaseordereditform, max_num=100, extra=2, can_delete=false)   guformset = groupuserinlineformset (instance=mygroup) 

might point in right direction. not sure how can work manytomany relationship.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -

PostgreSQL 9.x - pg_read_binary_file & inserting files into bytea -