What we’ve accomplished so far: By the end of Part 4 Foodiegram had a functioning recipes app complete with templates, comments and basic user registration. Now we’ll polish the experience by exploring Django’s powerful admin interface. We’ll register our models, create an admin user and finish up with a few suggestions for further improvements.
Django ships with a powerful administration site. You’ve already included 'django.contrib.admin'
in INSTALLED_APPS
. Now register the Post
model so you can create and edit recipes through the admin.
Open posts/admin.py
and use the @admin.register
decorator. The Foodiegram tutorial displays the list columns and enables searching:
from django.contrib import admin
from .models import Post
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ['title', 'author', 'pub_date', 'views', 'likes']
list_filter = ['pub_date', 'author']
search_fields = ['title', 'description']
prepopulated_fields = {'slug': ('title',)}
date_hierarchy = 'pub_date'
Run the command to create an administrative user:
python manage.py createsuperuser
You’ll be prompted for a username, email and password. After creating the superuser, start the server again and log in at http://127.0.0.1:8000/admin/
. Use the admin interface to add a few recipes and see them appear on the homepage.
Testing your application
Return to the homepage and click through the recipes you added. Upload images, edit descriptions and verify that the view counter increments. Try adding comments from multiple users and replying to comments. Everything should work locally – if not, recheck your URLs and view logic.
Going further
You now have a functioning CRUD application: Create recipes from the admin, Read them on the homepage, Update them via the admin and (if you implement it) Delete them. With user registration and comments, Foodiegram feels like a real community recipe site.
Things to try next:
Add a like button on the detail page. Increment the likes
field via a view that handles AJAX requests.
Allow users to edit or delete their own posts through a front‑end interface.
Deploy your site to a hosting platform like Heroku or PythonAnywhere.
Most importantly, have fun experimenting. As Django’s own documentation notes, the development server is lightweight and intended for rapid prototyping – now it’s time to prototype your ideas.
Final thoughts: In the previous part we set up the admin site and tested our application. This concluding post summarises the journey, recaps the skills you’ve gained and offers ideas for pushing Foodiegram even further.
By following these six sections you built a complete recipe sharing application from scratch. You learned how to:
Set up a Python 3.5 environment using virtualenv
and virtualenvwrapper
.
Install Django 1.10 and scaffold a new project using django-admin startproject
.
Create and register a reusable app (posts
) with its own models, views, URL patterns and templates.
Serve static files and media during development.
Build a comments system with threaded replies and connect it to authenticated users.
Use Django’s admin interface to manage your data.
This tutorial intentionally sticks to features available in Django 1.10, but the core concepts haven’t changed much in later versions. Whether you’re using Foodiegram as a learning exercise or the basis of a real project, you now have a working CRUD application that you understand inside and out.
Happy coding and bon appétit!