All questions
Showing of 56What is Django and what are its key features?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Django is a high-level Python web framework built for rapid development and clean, pragmatic design. It follows the Model-View-Template (MVT) pattern.
Its key features:
- It comes batteries included, meaning common features ship with it. These include an admin interface, authentication and an Object-Relational Mapper (ORM) that maps classes to tables.
- It follows the DRY principle, short for Don't Repeat Yourself.
- It protects against common attacks such as SQL injection, cross-site scripting and cross-site request forgery.
- It scales to high-traffic sites. Its "shared-nothing" design means the parts share no state, so you can add database, cache or web servers.
- It suits both HTML sites and JSON APIs.
- It has a large community, ecosystem and documentation.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the MVT (Model-View-Template) architecture in Django.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
MVT splits a Django app into three parts: a model, a view and a template. In Model-View-Controller (MVC) terms, the controller is the framework itself, the URL dispatcher that sends each request to the right view.
- The model defines the data structure and the business logic tied to that data. It works with the database through the Django ORM, which maps classes to tables.
- The view holds the business logic for one request and acts as the bridge between model and template. It takes the request and returns a response.
- The template is the presentation layer, usually HTML. It defines how the data is displayed to users.
The URL dispatcher routes each request to a view. The view processes the request and works with the models. It then renders a template with the data, and Django sends the response to the user.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is Django ORM and what are its advantages?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Django's Object-Relational Mapping (ORM) layer lets you work with the database in Python code instead of SQL. It maps each model class to a table and each object to a row.
Its advantages:
- One API works across all the supported database backends. This database abstraction makes switching databases easier.
- Queries use parameters, which protects against SQL injection.
- You write queries in Python syntax, and the ORM generates the SQL for you.
- Migrations manage the schema automatically as your models change.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the difference between Django's urls.py and views.py?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
urls.py decides which view handles a URL, and views.py holds the code that handles it. Keeping them apart lets you change a URL without touching the logic behind it.
urls.py is the router. Its urlpatterns list maps URL patterns to views, and Django calls the view of the first pattern that matches. A pattern can also have a name, so templates and code build links with {% url %} or reverse() instead of hard-coding paths.
views.py holds the view functions or classes. Each one takes an HTTP request, runs the business logic and returns an HTTP response. Here it queries the articles and renders a template with them.
# urls.py
urlpatterns = [
path('articles/', views.article_list, name='article_list'),
]
# views.py
def article_list(request):
articles = Article.objects.all()
return render(request, 'articles/list.html', {'articles': articles})
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are Django apps and how do they differ from projects?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
A project is the whole Django application, and an app is a module inside it that handles one area of functionality. The project holds the settings, the configuration and the root URLs, and it contains several apps.
An app is a Python package for one feature, such as a blog or user accounts. You switch it on by adding it to INSTALLED_APPS. Because an app does not depend on one project, you can reuse it across different projects.
Apps should follow the single responsibility principle: each app has one clear purpose. A blog app should not also handle billing.
myproject/ # Project
├── blog/ # App
├── users/ # App
├── settings.py # Project settings
└── urls.py # Project URLs
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain Django model fields and provide examples of commonly used field types.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Model fields are class attributes that define the data type and constraints of each database column. The field class also sets the default form widget and basic validation.
Common field types, as in the example:
CharFieldstores short text, here up tomax_lengthcharacters.TextFieldstores long text.DateTimeFieldstores a date and time.auto_now_add=Truesets it when the row is first created.BooleanFieldstores true or false.ForeignKeyandManyToManyFieldlink to other models, and aForeignKeyneedson_delete.EmailFieldchecks for a valid email address.SlugFieldholds a short URL label, andunique=Truemakes it unique in the table.
class Article(models.Model):
title = models.CharField(max_length=200)
content = models.TextField()
published_date = models.DateTimeField(auto_now_add=True)
is_published = models.BooleanField(default=False)
author = models.ForeignKey(User, on_delete=models.CASCADE)
tags = models.ManyToManyField(Tag)
email = models.EmailField()
slug = models.SlugField(unique=True)
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is the difference between function-based views and class-based views?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
A function-based view is a plain function that turns a request into a response, while a class-based view inherits from one of Django's view classes. For the URL configuration, as_view() turns the class into a callable.
def article_list(request):
articles = Article.objects.all()
return render(request, 'articles/list.html', {'articles': articles})
Function-based views are simpler and more explicit. You read the whole flow top to bottom, and you branch on request.method yourself.
from django.views.generic import ListView
class ArticleListView(ListView):
model = Article
template_name = 'articles/list.html'
context_object_name = 'articles'
Class-based views provide more structure and reusability. Each HTTP method gets its own method instead of an if branch. Mixins, small classes whose methods several views inherit, share behaviour across views. The generic ListView above queries the articles and renders the template with attributes only, no methods.
The cost is that the flow is spread across parent classes you have to read.
Use a function for one-off or unusual logic. Use a class when the view follows a common pattern or shares code with others.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain Django's URL dispatcher and how URL patterns work.
Explain Django template language and its key features.
What is template inheritance and how does it work?
What are Django forms and what are their advantages?
What is the difference between Django forms and ModelForms?
Explain Django's built-in authentication system.
What is the difference between get, filter and all in the Django ORM?
What are Django model relationships? Explain ForeignKey, OneToOneField, and ManyToManyField.
Explain Django migrations and their purpose.
What is the difference between null=True and blank=True in Django model fields?
How do you handle different HTTP methods in Django views?
What is the purpose of on_delete parameter in ForeignKey relationships?
Explain Django QuerySets and lazy evaluation.
What are Django model managers and how do you create custom managers?
Explain select_related() and prefetch_related() in Django ORM.
What are Django model validators and how do you create custom validators?
What are Django's generic class-based views and when would you use them?
What are Django view decorators, and which ones are commonly used?
How do you create and use custom template tags and filters?
How do you handle form validation in Django?
What is CSRF protection in Django and how does it work?
How do you create custom user models in Django?
What are Django permissions and how do you implement custom permissions?
How do you implement role-based access control in Django?
How do you customize the Django admin interface?
What are admin actions and how do you create custom admin actions?
What is Django middleware and how does it work?
How do you create custom middleware in Django?
How do you create REST APIs in Django? Compare Django REST Framework with plain Django.
What are Django REST Framework serializers and their types?
How do you write tests in Django? Explain different types of tests.
What are Django test fixtures and factories?
Walk me through the request and response cycle in Django.
How do you manage database transactions in Django?
What are Q objects and F expressions used for in Django?
What is the difference between annotate and aggregate in Django?
How do sessions work in Django?
What are the model inheritance styles in Django?
What are common Django performance optimization techniques?
Explain Django's caching framework.
Explain Django's deployment with WSGI and ASGI.
What are Django signals and when should you use them?
What is database connection pooling and how do you implement it in Django?
What are common security vulnerabilities in Django and how do you prevent them?
How do you implement rate limiting in Django?
What are important Django settings for production deployment?
How do you handle static files and media files in Django production?
How do you run background tasks in Django?
How do you run Django migrations safely in production?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
Django in pictures.
A quick recap of Django in 31 short animated pictures, one idea at a time. About 8 min to get the whole topic back in your head before you walk in. Pause any picture, slow it down, or step through it.
Pro The first chapter is free to play. The other 28 pictures come with Pro.
Django cheatsheet
- Projects, apps & requests01
- URLs & views02
- Models & migrations03
- ORM queries & transactions04
- Templates & forms05
- Login, roles & sessions06
- Middleware, signals & admin07
- REST APIs & tests08
- Caching, pools & tasks09
- Security & deployment10
- The model11
- + 5 more inside
This picture is part of Pro. The first chapter is free to play; the other 28 pictures come with Pro.
Get Pro · $10/mo Already Pro? Sign in49 of 56 Django answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.