/apps/recipes/admin.py
from django.contrib import admin
from .models import Category, Recipe
admin.site.register(Category)
admin.site.register(Recipe)
(venv)website.com $ python manage.py runserver
2 categories
and 5 recipes
. Don’t forget to upload photos!Suggested category names:
Title | Slug |
---|---|
Breakfast | breakfast |
Mains | mains |
(venv)website.com $ git add .
(venv)website.com $ git commit -m "Activated models in Admin site"
(venv)website.com $ git status
The slug is usually the same as the article title but only supports dashes instead of spaces. Why don’t you try implementing an autofill feature for the slug field? Hint: use ModelAdmin’s
prepopulated_fields
option.