Complete the code to define a Django model with a character field named 'title'.
from django.db import models class Book(models.Model): title = models.[1](max_length=100)
The CharField is used to define text fields with a maximum length in Django models.
Complete the code to add a date field named 'published_date' to the model.
class Book(models.Model): published_date = models.[1]()
The DateField is used to store date values in Django models.
Fix the error in the model field definition to store a number of pages as an integer.
class Book(models.Model): pages = models.[1]()
IntegerField is the correct field for storing numbers. max_length is not valid for IntegerField and should be removed.
Fill both blanks to define a Boolean field named 'is_bestseller' with default False.
class Book(models.Model): is_bestseller = models.[1](default=[2])
BooleanField stores True/False values. Setting default=False means the field is False unless changed.
Fill all three blanks to create a model field 'rating' that stores decimal numbers with max 3 digits and 1 decimal place.
class Book(models.Model): rating = models.[1](max_digits=[2], decimal_places=[3])
DecimalField stores fixed-point decimal numbers. max_digits is total digits, decimal_places is digits after decimal.