Unit 5: Models and Migrations and Django Admin - Subjective Questions

INT253 — Web Development In Python Using Django • Practice Questions with Detailed Answers

20 questions

1

Explain what a Django model is and describe how it represents data in a database.

2

Describe the important steps involved in creating a model in Django. Include a suitable example.

3

What are migrations in Django? Explain their purpose and describe the difference between makemigrations and migrate.

4

Explain the complete workflow for modifying an existing Django model and applying the changes to the database.

5

Describe how the Django shell can be used to insert, retrieve, update, and delete model objects.

6

Compare get(), filter(), all(), and exclude() methods in the Django ORM.

7

Explain the concept of QuerySets in Django and discuss lazy evaluation with examples.

8

Explain the main advantages of using Django's Object Relational Mapping system instead of writing SQL queries directly.

9

What is a foreign key in Django? Explain how to define and use a model containing a foreign-key relationship.

10

Distinguish between one-to-one, one-to-many, and many-to-many relationships in Django models.

11

Explain how on_delete works with Django foreign keys. Compare CASCADE, PROTECT, SET_NULL, and SET_DEFAULT.

12

Describe the purpose of the Django admin interface and explain the steps for registering a model with it.

13

Explain how ModelAdmin can be customized to make the Django admin interface more useful.

14

Explain how groups and users are added and managed in Django.

15

Explain Django users and permissions. Distinguish between user permissions, group permissions, staff status, and superuser status.

16

Describe Django's database configuration and explain the important options in the DATABASES setting.

17

Compare SQLite, PostgreSQL, and MySQL as database choices for a Django application.

18

Explain the process of configuring a PostgreSQL database connection for Django.

19

Explain how a Django model is converted into database tables through migrations.

20

Explain how to perform update and delete operations using Django ORM QuerySets. Mention important precautions.