Django Web Framework - Module Quiz: Models


The
sqlmigrate
command generates the SQL query that will be executed when the migration is done.True
False
Which of the following sentences about the primary key is correct? Select all that apply.
The primary key attribute of the model should not be null.
The primary key attribute of the model should be an integer.
The primary key attribute of the model can be a string.
The primary key attribute of the model should be unique for each instance.
To use MySQL with Django, what actions need to be taken?
Install mysqlclient
Set 'ENGINE': 'django.db.backends.mysql'
Set 'USER': 'root'
Set 'PORT': '8000'
Which of the following statements are about the ForeignKey type is correct? Select all that apply.
A field of the
ForeignKey
type is used to establish a many-to-one relationship.A field of the
ForeignKey
type is used to establish a one-to-many relationship.A field of the
ForeignKey
type is used to establish a one-to-one relationship.A field of the
ForeignKey
type is used to establish a many-to-many relationship.
Which of the following built-in field types of a model stores numeric data? Select all that apply.
CharField
URLField
FloatField
IntegerField
The Django form is rendered in a tabular manner with a tag in the template. Identify the correct tag.
Which of the following expressions extracts the data in the form submitted by the user?
request.POST
form.is_valid
request.GET
Which of the following statements about a staff user is correct? Select all that apply.
A staff user cannot modify the permissions enabled for a user.
A staff user can create a group
A staff user can log in to the admin site
A staff user cannot create a new user
True or False. A superuser is allocated all permissions automatically to add, delete, and change the details of other users.
True
False
Which command option of the
manage.py
script is used to create an admin user for the Django admin site?shell
runserver
createuser
createsuperuser
Subscribe to my newsletter
Read articles from David Nguyen directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

David Nguyen
David Nguyen
A passionate full-stack developer from @ePlus.DEV