X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/2121965a8cce50d797ba70438f3a936085fe32a1..5a649a9e943f331ec61d2e86c3840397777ccfb6:/apps/catalogue/views.py?ds=inline diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index cf1ec128..d2e135c5 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -73,11 +73,11 @@ def logout_then_redirect(request): def create_missing(request): if request.method == "POST": form = forms.DocumentCreateForm(request.POST, request.FILES) - # tag_forms = [ - # (TagMultipleForm if category.multiple else TagSingleForm)( - # category=category, data=request.POST, prefix=category.dc_tag) - # for category in Category.objects.all()] - if form.is_valid(): # and all(tag_form.is_valid() for tag_form in tag_forms): + tag_forms = [ + (TagMultipleForm if category.multiple else TagSingleForm)( + category=category, data=request.POST, prefix=category.dc_tag) + for category in Category.objects.all()] + if form.is_valid() and all(tag_form.is_valid() for tag_form in tag_forms): if request.user.is_authenticated(): creator = request.user @@ -147,13 +147,13 @@ def create_missing(request): form = forms.DocumentCreateForm(initial={'owner_organization': org}) - # tag_forms = [ - # (TagMultipleForm if category.multiple else TagSingleForm)(category=category, prefix=category.dc_tag) - # for category in Category.objects.all()] + tag_forms = [ + (TagMultipleForm if category.multiple else TagSingleForm)(category=category, prefix=category.dc_tag) + for category in Category.objects.all()] return render(request, "catalogue/document_create_missing.html", { "form": form, - # "tag_forms": tag_forms, + "tag_forms": tag_forms, "logout_to": '/', })