Wednesday, March 30, 2011

How to filter the list_display in the django admin with the request.session[user_id]

I need to know how to filter in the django admin model License, the
licenses of the user logged-in to the admin.

class License(models.Model):
user = models.ForeignKey('wiki.User')
name = models.CharField(max_length = 100)

def __unicode__(self):


So if Bob has created in the License Model 3 licenses, but John has
created only two, then the model has 5 licenses total, but if Bob logs
in to the admin he should only see his licenses (3 Licenses).

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment