You can override
get_queryset method in your model admin class.
class MyModelAdmin(admin.ModelAdmin): def get_queryset(self, request): qs = super(MyModelAdmin, self).get_queryset(request) if request.user.is_superuser: return qs return qs.filter(author=request.user)
Note in Django<=1.5 the method was named just
- How can I restrict Django’s GenericForeignKey to a list of models?
- Tying in to Django Admin’s Model History
- Using Django auth UserAdmin for a custom user model
- How to limit queryset/the records to view in Django admin site?
- Extending the User model with custom fields in Django
- When saving, how can you check if a field has changed?
- What’s the difference between django OneToOneField and ForeignKey?
- Django auto_now and auto_now_add
- Can “list_display” in a Django ModelAdmin display attributes of ForeignKey fields?
- Django: Get model from string?
- Dynamic File Path in Django
- Django: How can I protect against concurrent modification of database entries
- Django – Circular model import issue
- Django: Populate user ID when saving a model
- Get model’s fields in Django
- How to ‘bulk update’ with Django?
- Django accessing ManyToMany fields from post_save signal
- How to view corresponding SQL query of the Django ORM’s queryset?
- In a django model custom save() method, how should you identify a new object?
- Using a UUID as a primary key in Django models (generic relations impact)
- Django – Simple custom template tag example
- Custom QuerySet and Manager without breaking DRY?
- Django ManyToMany filter()
- Django: Query using contains each value in a list
- What does on_delete do on Django models?
- Setting the selected value on a Django forms.ChoiceField
- How can I have two foreign keys to the same model in Django?
- How do you serialize a model instance in Django?
- Django – filtering on foreign key properties
- How to make email field unique in model User from contrib.auth in Django
- Select DISTINCT individual columns in django?
- Django: How to get current user in admin forms?
- Django ModelForm override widget
- Nested inlines in the Django admin?
- Django delete FileField
- Dropdown in Django Model
- Django – how to specify a database for a model?
- how to write a query to get find value in a json field in django
- How to add data into ManyToMany field?
- Django – Overriding the Model.create() method?
- Django Migrations Add Field with Default as Function of Model
- django dynamically filtering with q objects
- Django: accessing the model instance from within ModelAdmin?
- Django: Validate file type of uploaded file
- Django admin file upload with current model id
- How to query Case-insensitive data in Django ORM?
- Creating Custom Filters for list_filter in Django Admin
- one-to-many inline select with django admin
- Django comparing model instances for equality
- UnicodeEncodeError: ‘ascii’ codec can’t encode character