A Django model
typically refers to a table in the database, attributes of that model becomes the column of that table. In more of a real-world example, you would create a model for any entity in your application, and store its attributes with django fields
which automatically handles data-types conversions for the database you would be using.
One of the great features for Django is its ORM
, you don't have to write any database query, and even it's recommended NOT to write one when using Django. ORM converts your Django models
and all the operations you do with it to the corresponding database queries. This means that all the manipulation you have to do, it now with the python objects created out from that model, and all the underlying database stuff would be taken care by Django's ORM
. There are a bunch of tweaks and customizations you could do with it.
Django's ORM
supports all the major database like Postgres
, MySQL
, sqlite3
, and other enterprises database provided with proper drivers. This also means that you don't have to care what underlying database you are using, or even if you want to shift from one database from another, you can do it without changing a single line of your application logic, just change the database string from settings.py
, dump the old data, and you should be good to go.