Models & ORM Flashcards

(4 cards)

1
Q

Where are models defined in Django?

A

In models.py in each app.

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

What’s the purpose of __str__()?

A

Returns a human-readable string for model instances.

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

How do you filter records?

A

Model.objects.filter(fieldname__contains=’value’)

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

What does get_absolute_url() do?

A

Returns the object’s detail view URL.

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