how to add to admin.py 3 or more models?

How add to admin.py admin.register for 3 model: Page/PageAdmin/PageListing?
Below screenshot from my code:
126235511_159255999237188_6259786629808175105_n

1 Like

If you have three different models with the name Page, PageAdmin and PageListing (and not three views that all display the same model), then you would register each of those models using the admin decorator.

from django.contrib import admin
from .models import Page, PageAdmin, PageListing

admin.site.register(Page)
admin.site.register(PageAdmin)
admin.site.register(PageListing)

(You could also use the admin.register decorator with custom admin classes if necessary.)

Note: when you post code here, please do not post screenshots. Copy and paste your code here, and enclose it between lines consisting of only three backtick - ` characters. That means you’ll have one line of ```, then your code, then another line of ```. This preserves the formatting of the code making it a lot easier to read - especially with statements where indentation is critical.

example:

# The line above this is ```
def function(self):
    return self
# The line after this is ```

Ken