Skip to content

Re-rendering a form with validation errors results in blank fields #18

Closed
@georgebrock

Description

@georgebrock

When a form using a composite type widget is used with a generic form view (e.g. django.views.generic.UpdateView, or from the Django admin site), and the form has validation errors, the widgets that make up the composite type will be rendered without their values.

The issue seems to be that the CompositeTypeWidget.render method uses getattr(value, subname, None) to retrieve the values for the individual fields. This fails because when we're rendering the form with validation errors value is a dict, and not an instance of a subclass of CompositeType (as it is when we're rendering the form without errors).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions