X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/5e942ab9a9a217a8482a324c3e61fdd83c1c4247..3263fb5558f69c727e61a6d4c0b3575a0f081ef6:/apps/catalogue/views.py?ds=inline diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index cf1ec128..4c1a21ce 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,14 @@ 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, tutorial_no=i, prefix=category.dc_tag) + for i, category in enumerate(Category.objects.all(), start=2)] return render(request, "catalogue/document_create_missing.html", { "form": form, - # "tag_forms": tag_forms, + "tag_forms": tag_forms, "logout_to": '/', })