FOR REVISION Flashcards

(20 cards)

1
Q

Which class customizes model display in Django admin?

A

ModelAdmin

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which file registers models in the Django admin interface?

A

admin.py

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What keyword in SQLite prevents NULL entries?

A

NOT NULL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does ACID stand for in database transactions?

A

Atomic, Consistent, Isolated, Durable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which Django field is used for large text?

A

TextField

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which method returns a readable string in a Django model?

A

__str__()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which argument makes a model field optional?

A

blank=True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of the Meta class in a model?

A

Defines metadata like ordering

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What command applies migration changes to the database?

A

python manage.py migrate

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does get_absolute_url() do?

A

Returns a URL for an object’s detail view

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does as_view() do in Django?

A

Converts a class-based view to a callable view

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What command creates a Django app?

A

python manage.py startapp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which field type defines a one-to-many relationship?

A

ForeignKey

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does request.session.get(“key”, default) do?

A

Retrieves a session value safely

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the default storage for sessions in Django?

A

Database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What command creates a new Django project?

A

django-admin startproject projectname

17
Q

Which tag is used to extend a base template in Django?

A

{% extends %}

18
Q

How do you add pagination in a Django ListView?

A

paginate_by = 10

19
Q

Which model field generates unique values automatically?

20
Q

What command collects static files in Django?

A

python manage.py collectstatic