django integer field example 1

django integer field example

integer = models.IntegerField(blank=True, null=True)

Here is what the above code is Doing:
1. We’re importing the models module from the django.db package.
2. We’re defining a new class called Question, which subclasses django.db.models.Model.
3. Each model is represented by a class that subclasses django.db.models.Model.
4. Each attribute of the model represents a database field.
5. With the above code, Django gives you the following:
– An automatically-generated database schema (CREATE TABLE statements) for this app.
– A Python database-access API for accessing Question and Choice objects.

Similar Posts