This is a pre-release. djust 1.2.1 has shipped since: read the djust 1.2.1 release notes.
Part of djust 1.2 — read the 1.2 release notes.
Fixed
A form field with a callable
initialgets the value, not the function.FormMixinandWizardMixinreadfield.initialdirectly, soUUIDField(initial=uuid.uuid4)orinitial=timezone.nowstored the function itself. Both now use Django'sform.get_initial_for_field(), which calls it, at mount, inreset_form(), and in the wizard'sform_dataandas_live_field. InFormMixin, the bug was hidden until #2974: the sync afterform_validused to overwrite the function, but oncereset_form()insideform_validstopped being undone, the function object reached the page (<function uuid4 at 0x…>) and failed the next submit with "Enter a valid UUID". Found by running djust.org's test suite against 1.2.1rc1. This also matches Django in two smaller ways:- A form's own
self.initial[...]now wins over the field'sinitial. datetime/timeinitials drop microseconds when the widget doesn't render them.
The wizard also stops turning
initial=0orinitial=Falseinto"".- A form's own