Skip to content

Admin panel

Amin Zamani edited this page Mar 22, 2023 · 1 revision

Every Django projects come with an Admin Panel that can be open at /admin url (ex: localhost:8000/admin)

Display model in admin panel

To display the model in the Admin panel register the model in the <app_name>/admin.py file

from .models import Blog
admin.site.register(Blog)

Customize Admin Panel

For each models you can specify the fields you want to use

# Custom model Admin (admin.py): 
class BlogAdmin(admin.ModelAdmin)
    fields = ("title", "description") # Fields to use for add/edit/show page
    list_display = ("title", "description") # fields to display in search page
    list_display_links = ("title") # fields that will be a link in search page
    ordering("date_created",) # Ordering allowed in the search page
    search_fields("title", "description") # Search fields allowed in the search page

# Register app
admin.site.register(Blog, BlogAdmin)

Python

Python Essentials 1 (PCEP)

Introduction to Python and computer programming

Data types, variables, basic I/O operations, and basic operators

Boolean values, conditional execution, loops, lists and list processing, logical and bitwise operations

Clean Code

Algorithms

Django

Django Rest Framework

API

pip

SQLAlchemy

FastAPI

Pytest

TDD

Git

Linux

Docker

Python Testing

Interview Questions

Clone this wiki locally