Thanks Todd. That's what I needed. Thought it might be that simple.
On Dec 9, 7:01 pm, "Todd O'Bryan" <[EMAIL PROTECTED]> wrote:
> s = Student.objects.get(pk=student_id)
> if user in s.parents.all():
> // the user is legit
> else:
> // user is not s's guardian
>
> On Dec 9, 2007 6:11 PM, radioflyer <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have a m2m relationship between users (guardians) and students.
>
> > I want to check if the currently logged in user has permission to edit
> > a particular student.
>
> > s = Student.objects.get(pk=student_id)
> > parents = s.parents.all()
>
> > And then check if logged in user.id matches against any of the parent
> > ids.
>
> > Is there a query set method for this? If not, what would the Python
> > look like? (Learning Python as I learn Django.)
>
> > Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---