> 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.
Looks like you're interested in something like
parents = s.parents.filter(user = request.user)
or possibly
parents = s.parents.filter(user_id = request.user.id)
or even using get() instead of filter() which assumes that a user
ID maps to only one parent as in
class Parent(Model):
user = ForeignKey(User, unique=True)
-tim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---