Personal Catalogue: Django & PostgreSQL — Chapter 3, Exercise 1 ==================================================== TASK Create a superuser, register all three models with the customized ItemAdmin from this chapter, and add three real items through the admin — one book (with at least two tags), one CD, and one DVD. SOLUTION 1. Create the superuser: python manage.py createsuperuser Follow the prompts for username, email, and password. 2. catalogue/admin.py should read: from django.contrib import admin from .models import Item, ItemType, Tag @admin.register(Item) class ItemAdmin(admin.ModelAdmin): list_display = ('title', 'item_type', 'creator', 'release_year', 'created_at') list_filter = ('item_type', 'tags') search_fields = ('title', 'creator') filter_horizontal = ('tags',) admin.site.register(ItemType) admin.site.register(Tag) 3. Run the server (python manage.py runserver), log into /admin/ with the superuser account, and add three items: - A book: e.g. title "Fluent Python", creator "Luciano Ramalho", item_type "book", release_year 2022. In the tags widget, add at least two tags (e.g. "Python" and "Programming") using the filter_horizontal two-column selector. - A CD: e.g. title "The Dark Side of the Moon", creator "Pink Floyd", item_type "cd", release_year 1973. Tags can be left empty, since the real spec only tags books. - A DVD: e.g. title "Inception", creator "Christopher Nolan", item_type "dvd", release_year 2010. 4. Confirm all three appear correctly on the Item list page, with the book showing its attached tags, and use the list_filter sidebar to filter the list down to just book-type items. WHY THIS WORKS AS AN ANSWER ---------------------------- It follows the real setup sequence in order (superuser before login, admin registration before the interface exists), uses the customized ItemAdmin exactly as written in the chapter, and exercises every real field type the schema defines, including the tags many-to-many.