Building a to-do app with Django

One of the best projects to undertake to learn Django is the to-do app. It teaches you to read and write to databases, about the models, views and templates concepts within Django and all about how to integrate the functionality into a nice user interface.

To run my project, I used a one-click install on Digital Ocean – as I just wanted to get down to coding & wasn’t too bothered about setting up the environment myself. After launching the django one-click deploy Digital Ocean instance, I ran the below commands to star the app; make the directories I was going to require & make sure the deployment was ready for development to begin.

  • cd /home/django/
  • cd django_project/
  • python manage.py startapp netshock
  • cd netshock/
  • mkdir templates
  • mkdir authenticate
  • sudo apt-get update
  • systemctl restart gunicorn.service
  • python manage.py runserver 0.0.0.0:8000
  • python manage.py makemigrations
  • python manage.py migrate
  • python manage.py createsuperuser

The full code of the project is below. This code achieved:

  • Login and logout
  • Add new tasks
  • Assign tasks to other users
  • Only see tasks you created or that you’re assigned to
  • Mark tasks as completed and uncomplete them if marked by accident
  • Delete tasks
  • Add notes to tasks
  • View stats on the overall project

The user interfaces are:

Views.py

Models.py

Urls.py

admin.py

home.html

base.html

login.html

counts.html

Notes.html