Database Modelling
1. Working with Models
Storing data in a database is a common practice in most web applications. In a Django project, it
involves working with Django models. Django will turn these models into database table for us.
Model – a model contains the fields and behaviors of the data we want to store. Commonly each models
maps a database table.
Django models basics
- Each model is a class that extends django.db.models.Model
- Each model attribute represents a database column
Django.db – this module helps to define and map the characteristic of the model to the database.
Model properties/ model types
CharField – is a string for small-to-large-sized strings, max_length argument is required
2. Installing Pillow – adds image processing capabilities to our python interpreter
3. Managing Migrations – Migrations allow us to generate a database schema based on model
code. In the end, migrations allow us to have a trace of the evolution of our database schema.