Skip to content

Django Framework

Master Django Framework with 50 free flashcards. Study using spaced repetition and focus mode for effective learning in Programming.

🎓 50 cards ⏱️ ~25 min Advanced
Study Full Deck →
Share: 𝕏 Twitter LinkedIn WhatsApp

🎯 What You'll Learn

Preview Questions

12 shown

What is Django?

Show ▼

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It follows the MTV (Model-Template-View) architectural pattern and includes built-in features like an ORM, admin interface, and authentication system.

What is the Django MTV pattern?

Show ▼

MTV stands for Model-Template-View:
Model – defines data structure and database schemaTemplate – handles the presentation layer (HTML)View – contains business logic and returns responses

How do you create a new Django project?

Show ▼

Use the command:
django-admin startproject myproject
This generates the project directory with settings.py, urls.py, wsgi.py, asgi.py, and manage.py.

How do you create a new Django app?

Show ▼

Run:
python manage.py startapp myapp
Then add 'myapp' to the INSTALLED_APPS list in settings.py to register it with the project.

What is a Django model?

Show ▼

A Django model is a Python class that subclasses django.db.models.Model. Each model maps to a single database table, and each attribute represents a database column. Example:
class Article(models.Model):
  title = models.CharField(max_length=200)

What are common Django model field types?

Show ▼

Common field types include:CharField – short text (requires max_length)TextField – long textIntegerField – integersBooleanField – True/FalseDateTimeField – date and timeForeignKey – many-to-one relationshipManyToManyField – many-to-many relationship

What is the Django ORM?

Show ▼

The Object-Relational Mapper (ORM) lets you interact with the database using Python code instead of raw SQL. You use model classes and querysets like MyModel.objects.filter(active=True) to query, create, update, and delete records.

How do you retrieve all objects from a model?

Show ▼

Use the all() method on the model's manager:
all_articles = Article.objects.all()
This returns a QuerySet containing all rows in the corresponding table.

How do you filter querysets in Django?

Show ▼

Use filter() and exclude():
Article.objects.filter(status='published')
Article.objects.exclude(status='draft')
You can chain lookups like title__icontains='django', date__gte=some_date, and author__name='Alice'.

What is the difference between filter() and get() in Django ORM?

Show ▼

filter() returns a QuerySet (zero or more objects), while get() returns a single object or raises exceptions:DoesNotExist – if no match is foundMultipleObjectsReturned – if more than one match exists

What are Django migrations?

Show ▼

Migrations are version-controlled changes to your database schema. Key commands:
python manage.py makemigrations – creates migration files from model changes
python manage.py migrate – applies migrations to the database
They are stored as Python files in each app's migrations/ directory.

How do you roll back a migration in Django?

Show ▼

Specify the migration name to revert to:
python manage.py migrate myapp 0003_previous
To undo all migrations for an app:
python manage.py migrate myapp zero

🎓 Start studying Django Framework

🎮 Study Modes Available

🔄

Flashcards

Flip to reveal

🧠

Focus Mode

Spaced repetition

Multiple Choice

Test your knowledge

⌨️

Type Answer

Active recall

📚

Learn Mode

Multi-round mastery

🎯

Match Game

Memory challenge

Related Topics in Programming

📖 Learning Resources