What is the Django Admin, and how does it discover which models to display?
Last updated
The Django Admin is an auto-generated, model-driven web interface for CRUD operations on your data, intended for trusted staff users. It discovers models through an explicit registration step performed when each app's admin.py is autodiscovered.
What it provides: List, add, edit, delete pages plus search, filters, and permissions, all derived from model field definitions.
How discovery works:
On startup
admin.autodiscover()imports theadmin.pymodule of every app inINSTALLED_APPS.Models appear only when explicitly registered with
admin.site.register(Model)or the@admin.registerdecorator.
Customization: A
ModelAdminsubclass controlslist_display,search_fields,list_filter, inlines, and more.
[lang:python]
from django.contrib import admin
from .models import Article
@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
list_display = ("title", "published")
search_fields = ("title",)
- https://meduzzen.com/blog/django-interview-questions/
- https://levelup.gitconnected.com/python-vs-go-for-backends-i-built-the-same-api-in-both-performance-shocked-me-8d57e6611577
- https://codefinity.com/blog/Top-50-Technical-Interview-Questions-for-Django-Developers
- https://www.geeksforgeeks.org/python/django-interview-questions/
- https://www.turing.com/interview-questions/django
- https://www.interviewbit.com/django-interview-questions/
- https://github.com/Devinterview-io/django-interview-questions
- https://foysalff.medium.com/12-advanced-django-interview-questions-for-experienced-developers-dbe654e21a45
- https://medium.com/@k0318383/django-vs-fastapi-which-framework-should-you-choose-for-your-backend-ab84cb8da33a
- https://digiqt.com/blog/django-interview-questions-for-employers/
- https://nareshit.com/blogs/django-flask-fastapi-which-to-learn-full-stack-python
- https://www.igmguru.com/blog/django-interview-questions
- https://medium.com/@tahakotwal54/django-vs-fastapi-which-one-should-you-choose-for-your-next-backend-project-50382c8c62c1
- https://blog.jetbrains.com/pycharm/2023/12/django-vs-fastapi-which-is-the-best-python-web-framework/
- https://www.youtube.com/watch?v=L5EPuiiQfY4