For student and course models created in Module 2, register admin interfaces, perform migrations, and illustrate data entry through admin forms

For student and course models created in Module 2, register admin interfaces, perform migrations, and illustrate data entry through admin forms

Program:-

python manage.py createsuperuser 

admin.py:-

# admin.py
from django.contrib import admin
from ap3.models import Course, Student

admin.site.register(Student)

admin.site.register(Course)

urls.py:-

# urls.py
from django.contrib import admin
from django.urls import path, re_path

from ap3.views import course_search

admin.site.site_header = "TAS Site Header"
admin.site.site_title = "TAS Site Title"
admin.site.index_title = "TAS Site Index"

urlpatterns = [
    path('admin/', admin.site.urls),
    path('course_search/', course_search),
]

Perform remigrations before running:

python manage.py makemigrations ap3
python manage.py migrate

Leave a Reply

Your email address will not be published. Required fields are marked *