Skip to content

Admin: add view popup breaks if initial submit has validation error #612

@pannkotsky

Description

@pannkotsky

Scenario:

  • in Django admin click green + next to the foreign key field that opens PolymorphicParentModelAdmin add view
  • Submit form with validation error
  • Fix the error and submit again

Expected:

  • object is added, popup is closed, object is populated to the foreign key field widget on the original form

Actual:

  • popup is not closed, field widget is not populated

This happens because after initial submit with validation error the query params indicating popup are removed, and only ct_id param is preserved. It comes from the following lines of code: https://github.com/jazzband/django-polymorphic/blob/master/polymorphic/admin/parentadmin.py#L202-L208

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions