StaffCoder
Django
DjangoDjango 5.2Python 3.13
18 modules · 72 challengesSign up
Modules18 modules · 72 challenges
Turn model rows into API payloads and back: explicit field declarations, a ModelSerializer reading its rules from the model, field and cross-field validation, and one payload carrying the lot.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Serialized Product Payload

Sign up to unlock
—No data yetmedium
About this challenge

The product endpoint used to hand-build its response dicts and pick fields out of the raw request body, so field types drifted between endpoints and malformed input reached the database. Declare one plain Serializer with typed, constrained fields, so instances render to the defined payload, input is refused field by field, and save routes to create or update.

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

Model Backed Serializer

Sign up to unlock
—No data yetmedium
About this challenge

A hand-typed serializer restates its model's fields, drifts out of step with the columns after every change, and lets a client overwrite the values the server owns. Derive it from the model instead, with an explicit field list, read-only server-managed values, a write-only cost, and the taken sku answered as a field error.

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

Serializer Validation Rules

Sign up to unlock
—No data yetmedium
About this challenge

Appointments that start in the past or end before they start reach the clinic's database because the serializer only checks types, and a partial edit is waved through unchecked. Layer the field rule, the cross-field rule and one shared count rule onto the serializer so every submitted value is judged, whether the update is whole or partial.

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

Room Booking Payloads

STAR
Solving it completes the module
—No data yetmedium
About this challenge

A room-booking service checks nothing a client sends it, so a stay in the past, a stay that ends before it begins, a party larger than the room sleeps and a reference somebody already has all reach the database or corrupt a booking on the way. Build the whole payload layer: a booking serializer derived from the model with an explicit field set, server-owned values, a write-only note, field and cross-field rules, and a plain serializer for the availability query.

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.