Exercise 2: commit=False vs. read_only_fields — Possible Solution ==================================================================== HOW commit=False WORKS (CHAPTER 6) ------------------------------ form.save(commit=False) returns an unsaved model instance built from the form's already-validated data. The view then sets additional fields (like status) directly on that Python object in code, before finally calling .save() to actually commit it to the database. The form itself never even declares that field - the value is applied entirely outside the form, in the view's own code, between validation and saving. HOW read_only_fields WORKS (THIS CHAPTER) ------------------------------ read_only_fields tells the serializer itself that a listed field should be included when serializing output (so a GET request still returns its current value), but any value submitted for that field on input is simply ignored rather than being applied - the serializer handles this distinction internally, rather than the view needing to intervene between validation and saving the way commit=False requires. THE ACTUAL DIFFERENCE ------------------------------ Both prevent a client from controlling a field's value, but commit=False achieves this by keeping the field out of the form/serializer entirely and setting it manually in view code afterward, while read_only_fields keeps the field visible in both directions (readable in output) while making it explicitly non-writable as an intrinsic property of the serializer's own field configuration - a difference in where and how the restriction is actually enforced, not just a renamed version of the same mechanism. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains commit=False as a two-step process (unsaved instance, then manual field assignment in view code) versus read_only_fields as a serializer-level configuration that allows output but blocks input for the same field, correctly identifying them as genuinely different mechanisms rather than equivalent techniques under different names.