I'm using the row-level permission model known as django-granular-permissions (http://code.google.com/p/django-granular-permissions/). The permission model simply has just two more fields which are content-type and object id.
I've used the following query:
User.objects.filter(Q(row_permission_set__name='staff') | \
Q(row_permission_set__name='student'), \
row_permission_set__object_id=labsite.id)
I want to add is_staff
and is_student
boolean fields to the result set without querying everytime when I fetch the result.
Django documentation shows extra() method of querysets, but I can't figure out what I should write for plain SQL selection query with this relation.
How to do this?