Registering the image model in the administration site

Edit the admin.py file of the images application and register the Image model into the administration site, as follows:

from django.contrib import admin
from .models import Image

@admin.register(Image)
class ImageAdmin(admin.ModelAdmin):
list_display = ['title', 'slug', 'image', 'created']
list_filter = ['created']

Start the development server with the python manage.py runserver command. Open http://127.0.0.1:8000/admin/ in your browser, and you will see the Image model in the administration site, like this:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset