Model Field - Django ORM Working - Part 2

The last post covered the structure of Django Model. This post covers how the model field works, what are the some important methods and functionality and properties of the field. Object-Relational Mapper is a technique of declaring, querying the database tables using Object relationship in the programming language. Here is a sample model declaration in Django. class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') Each class inherits from models.Model becomes a table inside the SQL database unless explicitly marked as abstract. [Read More]

Structure - Django ORM Working - Part 1

Django ORM hides a lot of complexity while developing the web application. The data model declaration and querying pattern are simplified, whereas it’s structured differently behind the scenes. The series of blog posts will explain Django ORM working(not just converting Python code to SQL), model declaration, querying (manager, queryset), supporting multiple drivers, writing custom queries, migrations etc… Consider a model definition from the Django tutorial. from django.db import models class Question(models. [Read More]