How to customize Django Admin panel ?

Feb. 21, 2021, 8:30 p.m.


...

1) Go to admin.py file
2) Create a class {modelname}Admin
3) admin.site.register({modelname}, {modelname}Admin)
4) Save and go to admin page of your application.

1) Go to admin.py file
2) Create a class {modelname}Admin
3) admin.site.register({modelname}, {modelname}Admin)
4) Save and go to admin page of your application.

Go to admin.py file and create a class according to your requirements

class bookAdmin(admin.ModelAdmin):
  search_fields=['title'] #search field
  fields=['isbn','title','price','desc'] #order of fields
  list_editable=['price'] #editable field
  list_filter=['Category','author']

admin.site.register(book,bookAdmin)




Tags


Comments