FOR REVISION Flashcards
(20 cards)
Which class customizes model display in Django admin?
ModelAdmin
Which file registers models in the Django admin interface?
admin.py
What keyword in SQLite prevents NULL entries?
NOT NULL
What does ACID stand for in database transactions?
Atomic, Consistent, Isolated, Durable
Which Django field is used for large text?
TextField
Which method returns a readable string in a Django model?
__str__()
Which argument makes a model field optional?
blank=True
What is the purpose of the Meta class in a model?
Defines metadata like ordering
What command applies migration changes to the database?
python manage.py migrate
What does get_absolute_url() do?
Returns a URL for an object’s detail view
What does as_view() do in Django?
Converts a class-based view to a callable view
What command creates a Django app?
python manage.py startapp
Which field type defines a one-to-many relationship?
ForeignKey
What does request.session.get(“key”, default) do?
Retrieves a session value safely
What is the default storage for sessions in Django?
Database
What command creates a new Django project?
django-admin startproject projectname
Which tag is used to extend a base template in Django?
{% extends %}
How do you add pagination in a Django ListView?
paginate_by = 10
Which model field generates unique values automatically?
AutoField
What command collects static files in Django?
python manage.py collectstatic