Re: how to check manytomany field in filter?
well... that worked... to be 100% honest... i didn't expect it to. Guess i'm still underestimating the framework thanks :) On Feb 2, 9:28 pm, Martin Conte Mac Donellwrote: > On Tue, Feb 3, 2009 at 12:21 AM, garagefan wrote: > > > Trying to test a manytomany field in a model that will be user names. > > Building that is simple enough in the model, and so is selecting the > > users in the admin. > > > the problem is filtering a query to test the current logged in user > > with the manytomany field to ensure they are listed. > > > ie: > > filter(Q(is_private=False) | Q(approvedUsers = str(request.user)) > > > where approvedUsers is the manytomany field > > Actually i don't understand fully what are you trying to do, but based > on your call: > > Did you try filter(Q(is_private=False) | Q(approvedUsers=request.user)? > > M --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: how to check manytomany field in filter?
On Tue, Feb 3, 2009 at 12:21 AM, garagefanwrote: > > Trying to test a manytomany field in a model that will be user names. > Building that is simple enough in the model, and so is selecting the > users in the admin. > > the problem is filtering a query to test the current logged in user > with the manytomany field to ensure they are listed. > > ie: > filter(Q(is_private=False) | Q(approvedUsers = str(request.user)) > > where approvedUsers is the manytomany field Actually i don't understand fully what are you trying to do, but based on your call: Did you try filter(Q(is_private=False) | Q(approvedUsers=request.user)? M --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
how to check manytomany field in filter?
Trying to test a manytomany field in a model that will be user names. Building that is simple enough in the model, and so is selecting the users in the admin. the problem is filtering a query to test the current logged in user with the manytomany field to ensure they are listed. ie: filter(Q(is_private=False) | Q(approvedUsers = str(request.user)) where approvedUsers is the manytomany field --~--~-~--~~~---~--~~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---