Hi Rajesh,

Thanks for pointing that out in the documentation, I wasn't aware of
that filter. However, I can't seem to get it to work.

I've tried specifying the values as:

staff_members_to_notify = models.ManyToManyField(Member,
limit_choices_to = {'member_type' : 'staff'})

and several other variations, and I can't get it to fail or succeed in
filtering the resulting list of Member objects. Thoughts?

Thank you,
Brandon



On May 30, 12:38 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> Hi Brandon,
>
> > I have two Models: Member, Job
>
> > Member has two types: Staff, Board
>
> > Job needs to have a ManyToMany field for Member, so I can send emails
> > to those associated records.
>
> > So, what I'm trying to accomplish is to filter the list of Members
> > that are shown in the ManyToMany to include only those with a type of
> > 'Staff'.
>
> > I've seen where we can add manager methods to change the initial
> > QuerySet that the Manager returns, but it seems that I would have to
> > define another table, and then supply the objects. Is that correct?
> > I'd appreciate some advice.
>
> Assuming that you want to do this in Django Admin, have you looked at
> the 'limit_choices_to' documentation?
>
> You would add the following parameter to your M2M relationship
> definition:
> limit_choices_to = {'member_type': 'Staff'}
>
> -Rajesh D
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to