Momentum logo
Team 14 Classroom

🐻 Queries & Using the Shell 🐻

Posted on Sep 8th, 2022

Today’s Topics

  • Interacting with models in the shell
  • Queries and more queries

🎯 Project: Still Working on Habit Tracker

Habit Tracker is due on Monday. You can do this! 💪 What do you need to figure out in order to finish it?

📖 Read | 📺 Watch | 🎧 Listen

  • Database Design for Beginners This is a talk from RailsConf, which is focused on Ruby on Rails (Rails is a framework for building web applications in Ruby, very similiar to Django). The talk is an excellent introduction to how to think about your data model – that is, the logic that drives the decisions you make about the models in your code and the structure of your database. Please watch it all the way through; even though it uses Ruby examples you should be able to get the gist.

Building APIs

This is prep material for the topic we will begin next week.

🔖 Resources

Using the shell (Django’s interactive REPL, not pipenv shell)

🦄 PRO TIPS

  • django-debug-toolbar has a SQL panel that will show you the queries you are running in the view.
  • With shell_plus, you can see output of all the SQL queries if you run it like this:
python manage.py shell_plus --print-sql

Lookups

Constraints

Aggregate & Annotate

🦉 Code & Notes

Back to home