django db models code example

Example 1: django models

Models in Django are classes that represent data base tables.

Example 2: django id

The ID in django is a "unique identifier" for each models instances.
You do not need to explicitly add a ID field to your own models as 
the ID attribute is automatically generated for you behind the scences
by django for each new model and any newly created instances of that 
model afterwards.

Example 3: from django.db import models

from django.db import models

class Person(models.Model):
  	"""
    	This class creates a new table with 
        the name of your application and that class name. 
        The fully qualified name of the table 
        will be "appName_className". 
        Also, two fields with data type char will be 
        created: first_name and last_name.
    """
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)