tags:

views:

19

answers:

0

The easiest example of the sort of relationship I'm talking about is that between Django's Users and Groups. The User table has a ManyToMany field as part of its definition and the Group table is the "reverse" side.

A note about my constraints: I am not working with the Admin interface at all nor is that an option.

Now, onto the programming problem. I need to write a form that is used to edit MyGroup instances, defined simply as the following:

class MyGroup( Group ):
  some_field = models.CharField( max_length=50 )

I want to be able to have a form page where I can edit both some_field and which users are members of the group. Because I'm working with a model, a ModelForm seems obvious. But I cannot figure out how to get Django to include the users because it is on the reverse side of the User-Group relationship. Ideally, I'd like the display widget for specifying the users to be like the one for specifying permissions that is found on the User and Group pages within Admin.