Creating the official Django Polls app table of contents

Thursday, January 2, 2025 at 4:38 AM | 3 min read

Last modified on Saturday, January 11, 2025 at 7:16 PM

#fullstack development, #macOS, #django, #python 3, #series, #tutorial

A yawning Carpet Python

Photo by David Clode on unsplash.com

In this series, I follow the official Django Polls application tutorial. After refactoring an application which had been created over seven years ago, I thought the best way to become even more familiar with the Django documentation would be to follow their Django Polls tutorial and create a Django Polls application.

Series Table of Contents

  1. Creating the official Django Polls app Part 1: In this section, I create a directory to house my Django Polls application, check if I have Django installed, select my Python interpreter, install virtualenv with pip, create a virtual environment for Django Polls, activate and deactivate the virtual environment, install Django, upgrade Django, create a project in Django Polls, initialize git, start up the Django development server, create an app called polls, write a first view, create a URLconf for the index view, and configure the global URL configuration.
  2. Creating the official Django Polls app Part 2: In this section, I set up the Django Polls database, explained/set LANGUAGE_CODE, USE_I18N, USE_THOUSAND_SEPARATOR, NUMBER_GROUPING, USE_TZ, and INSTALLED_APPS, create the polls models, activate the models, play with the API in the interactive Python shell, discuss the Django admin interface, create a superuser, start the development server, register polls app in polls/admin.py, and discuss the Question form in the admin interface.
  3. Creating the official Django Polls app Part 3: In this section, we write our first Django app, discuss URL patterns, write more views in polls/views.py, write views that actually work, re-write the index view, create a templates directory in the polls directory, implement template namespacing, add Django code to index.html, update the index view to use the new index.html template, implement the render() shortcut, implement raising a 404 error in the detail view, use get_object_or_404() in the detail view, discuss Model's manager in Django, discuss Manager names, use template tags in the template engining system, remove the hardcoded URL in the template in polls/index.html, and namespace our URL names.
  4. Creating the official Django Polls app Part 4: In this section, we add a minimal form to our polls.detail.html template, we update the function based vote view, create a polls/results.html template, refactor our polls/urls.py to match the new generic views, and we install DJLint to format our Django templates.
  5. Creating the official Django Polls app Part 5: In this section, we are introduced to automated testing. We discuss what automated testing is, why it's important to create tests, basic testing strategies, write our first test to identify a bug, fix the bug, create more comprehensive tests for Question.recently_published(), test a view, analyze the tools available to us in testing, are introduced to the Django test client, improve our PollsIndexView, test our new PollsIndexView, test the PollsDetailView, and break down the refactored PollsDetailView (which originally contained a bug which I fixed).
  6. Creating the official Django Polls app Part 6: In this section, we add static files to our Django Polls application configured for local development.
  7. Creating the official Django Polls app Part 7: In this section, we customize the Question admin form, add Choice related objects to the admin form, customize the admin change list, add search capability to the admin interface, customize the admin look and feel, and customize our project's templates.
  8. Creating the official Django Polls app Part 8: In this section, we install the Django Debug Toolbar, configure the toolbar so it appears in the browser when we run our development server, learn that we can customize the toolbar, run our Django Polls project in the browser to view the toolbar, are introduced to resources where we can access other third party packages to use in our applications, and are provided with next steps.