StaffCoder
Django
DjangoDjango 5.2Python 3.13
18 modules · 72 challengesSign up
Modules18 modules · 72 challenges
Route requests with path converters and named URLs, and return safe HTML, redirect, and JSON responses.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Article Routing

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

Only the home page is routed, so every article URL is a 404. Route articles by id, slug and four-digit year so the view receives typed values and malformed URLs are rejected before any view runs.

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

Named Routes And Redirects

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

Links and redirects break every time a URL changes. Name the routes inside an app namespace, build every link from those names, and send old post URLs to their new home with a permanent redirect.

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

Safe Detail And JSON Views

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

Product pages need a safe detail view and a JSON endpoint. Return the product page or a 404 for unknown ids, and serve the same product as properly encoded JSON with its price as a two-decimal string.

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

Recipe Site Views

STAR
Solving it completes the module
100%3 of 3 solvedeasy
About this challenge

A recipe site needs its whole request layer built. Add namespaced routes for the list, detail, year archive, JSON API and a legacy redirect, with typed URL arguments, 404s for bad input, and every URL built from its route name.

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

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.