Actually fix ensure_transient_values_persist call

oops
This commit is contained in:
Hugh Rundle 2023-04-16 19:58:53 +10:00
parent 6f025af99f
commit 5f5886edea

View file

@ -143,10 +143,11 @@ class CreateBook(View):
def ensure_transient_values_persist(request, data, **kwargs):
"""ensure that values of transient form fields persist when re-rendering the form"""
data["book"] = data.get("book") or {}
data["book"]["subjects"] = kwargs["form"].cleaned_data["subjects"]
data["add_author"] = request.POST.getlist("add_author")
data["cover_url"] = request.POST.get("cover-url")
if kwargs and kwargs.get("form"):
data["book"] = data.get("book") or {}
data["book"]["subjects"] = kwargs["form"].cleaned_data["subjects"]
data["add_author"] = request.POST.getlist("add_author")
def add_authors(request, data):