Django Web Framework - Module Quiz: Models

David NguyenDavid Nguyen
2 min read
  1. The sqlmigrate command generates the SQL query that will be executed when the migration is done.

    • True

    • False

  2. 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.

  3. 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'

  4. 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.

  5. Which of the following built-in field types of a model stores numeric data? Select all that apply.

    • CharField

    • URLField

    • FloatField

    • IntegerField

  6. The Django form is rendered in a tabular manner with a tag in the template. Identify the correct tag.

  7. Which of the following expressions extracts the data in the form submitted by the user?

    • request.POST

    • form.is_valid

    • request.GET

  8. 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

  9. True or False. A superuser is allocated all permissions automatically to add, delete, and change the details of other users.

    • True

    • False

  10. Which command option of the manage.py script is used to create an admin user for the Django admin site?

    • shell

    • runserver

    • createuser

    • createsuperuser


0
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