Accessing Migration Tables in Django
Learn how to view database tables from the Django administration site.
We'll cover the following...
We'll cover the following...
To see our database tables and fields on the Django admin page, we have to register our models in the admin.py file and also create a superuser.
Registering models
To register our model, let’s open the houses/admin.py file. Inside it, we'll see a boilerplate that imports the admin from django.contrib, as shown below:
The first line imports the admin from django.contrib, while the last line is a comment.
Then, we register our models by importing them and calling the admin.site.register to register our respective models:
Lines 3–4: We import our
HouseandCheckermodels fromhouses.models.Lines 8–9: We call on the
admin.site.registerto register our respective models.
Now we have ...