🐻 Queries & Using the Shell 🐻
Posted on Dec 2nd, 2021
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 know in order to finish it?
📖 Read | 📺 Watch | 🎧 Listen
This section is material to prep for the topic we will begin next week: building APIs.
- RESTful APIs – read up through the “Standard Methods” subsection of the section on “Methods”. You can read more if you want to but it gets pretty deep.
- Safia Abdullah, You and Me Learn All About HTTP
- Podcast: Advice for New Devs This is a front-end focused podcast but the advice is applicable to everyone.
🔖 Resources
- Pretty Printed Video: How Model Queries Work in Django
- Pretty Printed Video: Querying One-to-Many Relationships in Django
- Django QuerySets
- Django Model Managers
- Django Queries: Retrieving Objects
- Field lookups
- Lookups that span relationships
- Lookups with Related objects
- Django Related Objects Reference
- Complex lookups with Q
- F objects
Constraints
- Django Docs: model constraints -> this gives you the general format/syntax
- Django Docs: UniqueConstraint
Aggregate & Annotate
- PrettyPrinted Video: Basics of Django Aggregations
- Pretty Printed Video: How to Use Annotate in Django
- Django docs:Aggregate & Annotate
- Django docs: Combining Aggregations with other QuerySets
- Aggregation Functions (e.g.,
Avg
,Count
,Min
,Max
)