That gives an error... "Error was: 'Permission' object has no
attribute 'users'"

Seems like this should be easy...

On Sep 25, 11:32 am, "Norman Harman" <[EMAIL PROTECTED]> wrote:
> bobbyc881 wrote:
> > I'm generating a list of Users in a specific group, in this case,
> > "Artists", for a form:
>
> > artist_group = Group.objects.get(name="Artists")
> > artist =
> > forms.ModelChoiceField(queryset=User.objects.filter(groups=artist_group),
> > required=False)
>
> > I'd like to re-write this to avoid using a Group that could get
> > renamed, deleted, or change some other way in the future. I've created
> > a custom permission called "in_artist_pulldown" to use. Is there a way
> > to query Users that have the permission "in_artist_pulldown."  I can't
> > quite seem to figure out how to access that.
>
> User has a many to many relation with 
> Permissionshttp://docs.djangoproject.com/en/dev/topics/db/queries/#many-to-many-...
>
> user_permissions is the field name.
>
> So, I think the syntax would be this.
>
>    permission = Permission.objects.get(name="in_artist_pulldown")
>    users = permission.users.all()
>
> --
> Norman J. Harman Jr.
> Senior Web Specialist, Austin American-Statesman
> ___________________________________________________________________________
> Get off the sidelines and huddle up with the Statesman all season long
> for complete high school, college and pro coverage in print and online!
--~--~---------~--~----~------------~-------~--~----~
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