Fix přijímání prázdné množiny tagů
This commit is contained in:
parent
283320b161
commit
9a6b66f7d9
1 changed files with 5 additions and 2 deletions
|
@ -89,7 +89,6 @@ def opravy_a_komentare_view(request, pdf_id: int, **kwargs):
|
|||
if oprava_id != -1:
|
||||
oprava = get_object_or_404(Oprava, id=oprava_id)
|
||||
else:
|
||||
tagy = list(map(int, q.get('tagy').split(",")))
|
||||
pdf = get_object_or_404(KorekturovanePDF, id=pdf_id)
|
||||
oprava = Oprava.objects.create(
|
||||
pdf=pdf,
|
||||
|
@ -97,6 +96,10 @@ def opravy_a_komentare_view(request, pdf_id: int, **kwargs):
|
|||
x=x,
|
||||
y=y,
|
||||
)
|
||||
|
||||
tagy_raw = q.get('tagy')
|
||||
if tagy_raw != "":
|
||||
tagy = list(map(int, tagy_raw.split(",")))
|
||||
oprava.tagy.add(*KorekturaTag.objects.filter(id__in=tagy))
|
||||
Komentar.objects.create(oprava=oprava, autor=autor, text=text)
|
||||
|
||||
|
|
Loading…
Reference in a new issue