Skip to content

v1.29.0

Choose a tag to compare

@github-actions github-actions released this 30 Nov 09:17
· 4 commits to main since this release

Features

  • Dependent choices. A field's options can now depend on another value
    of the same form, like django-smart-selects in the classic admin: once
    an editor picks a country, the city picker only offers that country's
    cities. Field("city", limit_choices_to=Q(country=F("country"))) takes
    a Q object over the related model in which F("<field>") reads a
    form value, for ForeignKey and ManyToManyField pickers. While the
    value it reads is empty the field is disabled, with "Choose Country
    first" under it;
    when that value changes, a chosen city that no longer fits is cleared
    with a note under the field, and "New city" in the picker starts with
    the chosen country. Saving rejects a value that does not fit the
    submitted values (values that stay as they are keep saving). For rules
    a Q cannot express, subclass content_studio.form.ChoiceFilter
    (fields and filter(queryset, values, request)); fields with choices
    take DependentChoices("land", {"nl": [...], "be": [...]}). Inline
    studios take the same Field, and blocks declare
    Meta.limit_choices_to. The studio hook get_related_<field> is now
    documented as the low-level way to return a picker's options. New
    checks: content_studio.E071 for a limit that cannot work and
    content_studio.W046 for a limit that reads a field not on the edit
    page.