Momentum logo
Team 10 Classroom

🐻 Models & Queries 🐻

Posted on Nov 30th, 2021

πŸ—“οΈ Today’s Topics

  • The woes of deployment and what to do about them
  • Django managers, lookups, and querysets
  • Using the Django shell to test out your models and make queries

🎯 Project: Continue Building Habit Tracker

Today you should finalize your models and begin building out the urls, views, and templates you will need. Before you write the code, plan for what you will need.

There are examples for a lot of what you need to do in the Django Recipes codebase but you will have to adapt them to your Habit Tracker use cases.

πŸ”– Resources

Models

Managers and QuerySets

Queries

You can think of queries as talking to the database. To support all our CRUD actions, we need to be able to create, read, update, and delete objects from the database. Django has a built-in library that lets us do all that.

🌟 EXTRA/TMI

  • SQL Basics: Learn X in Y minutes -> this is a helpful reference for SQL syntax when you run into it. You do not need to write SQL for Django because the Django ORM does it for you, and it does it well. The Django docs often illustrate queries made by the ORM using SQL syntax, however, and you will find it helpful in your job to know the basics.
  • Postgres GUI: Postico

πŸ¦‰ Code & Notes

Back to home