Reputation: 3733
This is how looks template of Django Admin Model:
This is model which I created:
class ProfileUser(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
profile_image = models.URLField()
is_qualified = models.BooleanField(default=False)
How can I create same filter menu ? for is_qualified
?
Upvotes: 2
Views: 33
Reputation: 476594
You can specify this in the list_filter
attribute [Django-doc] of the ModelAdmin
you make for your model:
from django.contrib import admin
from app.models import ProfileUser
class ProfileUserAdmin(admin.ModelAdmin):
list_filter = ('is_qualified',)
admin.site.register(ProfileUser, ProfileUserAdmin)
It is however advisable only to use this for fields with a limited number of options (a BooleanField
of course is a good candidate for this).
Upvotes: 1