StaffCoder
Django

Django Practice Exercises

Django 5.2Python 3.13
18 modules · 72 challengesSign up
Modules18 modules · 72 challenges
Unlock the database layer of your applications with this comprehensive module on Django Models & Relationships
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Product Model Definition

Sign up to unlock
43%15 of 35 solvedeasy
About this challenge

Products lose data: prices come back wrong, names have no length limit, and nothing records when an item was added. Define a Product model with a bounded name, an exact decimal price, a stock count with a sensible default, an active flag, an auto-set creation time and a readable string form.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Author Book Foreign Key

Sign up to unlock
100%9 of 9 solvedeasy
About this challenge

Books and authors live in unrelated tables, so deleting an author leaves orphaned books. Relate Book to Author so an author's books go with the author and are listed through the author, and add an optional publisher that cannot be deleted while it still has books.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Course Enrollment Links

Sign up to unlock
83%5 of 6 solvedeasy
About this challenge

Students take many courses, courses have many students, and each student has exactly one transcript. Model the many-to-many and the one-to-one, readable from both sides, with at most one transcript per student enforced by the database.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Library Domain Schema

STAR
Solving it completes the module
56%5 of 9 solvedeasy
About this challenge

Model a library from scratch: members, books, authors, loans and member cards. Use every relationship kind: books to authors (many-to-many), loans that link a member and a book and carry their own due date, and one card per member, with delete rules and readable string forms throughout.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

About this path

Models, the ORM, views, forms, auth, caching and Django REST Framework.

Practice Django by building the pieces of real sites and APIs, one concept at a time. Each challenge opens a Django 5.2 project on Python 3.13 in a browser IDE, and its tests grade your code. The 18 modules follow how a Django app grows. You start with models and relationships, QuerySets, URLs and views, templates, the admin, static and media files, and forms. Then come class-based views, ModelForms and formsets, authentication and permissions, aggregation and annotation, query optimization with select_related and prefetch_related, middleware, sessions and messages, and caching. The last three modules move to Django REST Framework: serializers, views and routers, and token authentication with permissions. The challenges are small slices of real apps: a storefront, a library schema, a notes app, an invoice with line items, a task board API. 28 are easy and 44 are medium. You should be able to write basic Python before you start; no earlier Django experience is needed. Every module is open on a free account, and on every challenge you choose whether to work with AI agents, AI chat only, or no AI.

Frequently asked questions

9

What will I practice in this path?

18 modules: Models & Relationships, QuerySets & ORM Basics, URLs & Views, Templates, Django Admin, Static & Media Files, Class-Based Views, ModelForms & Formsets, Authentication & Authorization, Forms, ORM Aggregation & Annotation, Query Optimization, Middleware, Sessions & Messages, Caching, DRF Serializers, DRF Views & Routers and DRF Authentication & Permissions.

How many Django exercises are there, and how hard are they?

72 exercises: 28 easy and 44 medium.

What does this path run on?

Challenges run on Django 5.2 and Python 3.13.

Do I need to install anything?

No. Every challenge runs in a browser-based IDE with everything already set up, and your code is graded automatically against a test suite.

Does it cover Django REST Framework?

Yes. The last three modules are DRF: serializers, API views and routers, and token authentication with permission classes. That’s 12 challenges, ending with a shared notes API.

Is this path good for Django beginners?

Yes, if you know basic Python. The early modules (models, QuerySets, URLs and views, templates, the admin, static files and forms) are all easy. Medium challenges start with class-based views.

Can I read a challenge before signing up?

Yes. Every challenge has a public page with its full problem statement. Signing up lets you open it in the browser IDE and run the tests.

Is it free?

Yes. All 18 modules are open on a free account, within the free plan’s weekly hour and monthly solution unlock.

Can I use AI while I solve a challenge?

Yes, if you want to. Each challenge lets you choose how to work: with AI agents, with AI chat only, or with no AI at all.

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.