Django Models - Python Web Development

Published: 12 July 2021
on channel: codevev
399
14

#Python #Shorts

If you're familiar with SQL databases, then you may know that typically you need to use SQL statements to select, update, delete or insert the data into the database.

Django makes it easier and allows us using Python code to do all of it through what's known as ORM - object-relational mapping.

Whenever we created a new Django app, a new models.py file was generated inside it. This is where you can define your database models, or in the other words, the schema of the database.

All you need to do is create a new class or classes, which will represent the tables in SQL, make them inherit from models.Model, which comes from django.db, and define the fields, which will represent the columns in your table.

For all possible field types, please refer to the Django documentation: https://docs.djangoproject.com/en/3.2...

And in the next post we're going to see how to apply these models to the actual database, so make sure to subscribe to not miss out!
-------------------------------------------------------------------------------------
Links:
Blog: https://evgenyurubkov.com
Twitter:   / evgenyurubkov  
Instagram:   / evgenyurubkov  
Youtube:    / @codevev  


Watch video Django Models - Python Web Development online without registration, duration hours minute second in high quality. This video was added by user codevev 12 July 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 399 once and liked it 14 people.