PDF už dostáváme v URL, není to potřeba shánět znovu
This commit is contained in:
parent
1e6e6118a7
commit
62160e8440
2 changed files with 12 additions and 14 deletions
|
@ -57,7 +57,6 @@
|
|||
<br/>
|
||||
<textarea onkeypress="textarea_onkey(event);" id="commform-text" cols=40 rows=10 name="txt"></textarea>
|
||||
<br/>
|
||||
<input type="hidden" size="3" name="pdf" value='{{pdf.id}}'/>
|
||||
<input type="hidden" size="3" id="commform-x" name="x"/>
|
||||
<input type="hidden" size="3" id="commform-y" name="y"/>
|
||||
<input type="hidden" size="3" id="commform-img-id" name="img-id"/>
|
||||
|
@ -84,7 +83,6 @@
|
|||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<input type='hidden' name='action' value='set-state'/>
|
||||
<input type='hidden' name='pdf' value='{{pdf.id}}'/>
|
||||
<input type="radio" name="state" value="{{ pdf.STATUS_PRIDAVANI }}" {% if pdf.status == pdf.STATUS_PRIDAVANI %} checked {% endif %}>Přidávání korektur
|
||||
<br>
|
||||
<input type="radio" name="state" value="{{ pdf.STATUS_ZANASENI }}" {% if pdf.status == pdf.STATUS_ZANASENI %} checked {% endif %}>Zanášení korektur
|
||||
|
@ -121,7 +119,6 @@
|
|||
<form action='' onsubmit='save_scroll(this)' method='POST'>
|
||||
{% csrf_token %}
|
||||
<input type='hidden' name="au" value="{{o.autor}}"/>
|
||||
<input type='hidden' name='pdf' value='{{pdf.id}}'>
|
||||
<input type='hidden' name='id' value='{{o.id}}'>
|
||||
<input type='hidden' name='scroll'>
|
||||
|
||||
|
@ -196,7 +193,6 @@
|
|||
<!-- Komentar !-->
|
||||
<form action='' onsubmit='save_scroll(this)' method='POST'>
|
||||
{% csrf_token %}
|
||||
<input type='hidden' name='pdf' value='{{pdf.id}}'>
|
||||
<input type='hidden' name='id' value='{{k.id}}'>
|
||||
<input type='hidden' name='scroll'>
|
||||
{% if forloop.last %}
|
||||
|
|
|
@ -56,6 +56,11 @@ class KorekturyView(generic.TemplateView):
|
|||
template_name = 'korektury/opraf.html'
|
||||
form_class = OpravaForm
|
||||
|
||||
def setup(self, request, *args, **kwargs):
|
||||
super().setup(request, *args, **kwargs)
|
||||
self.pdf_id = self.kwargs["pdf"]
|
||||
self.pdf = get_object_or_404(KorekturovanePDF, id=self.pdf_id)
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
form = self.form_class(request.POST)
|
||||
q = request.POST
|
||||
|
@ -77,9 +82,8 @@ class KorekturyView(generic.TemplateView):
|
|||
y = int(q.get('y'))
|
||||
text = q.get('txt')
|
||||
strana = int(q.get('img-id')[4:])
|
||||
pdf = KorekturovanePDF.objects.get(id=q.get('pdf'))
|
||||
|
||||
op = Oprava(x=x,y=y, autor=autor, text=text, strana=strana,pdf = pdf)
|
||||
op = Oprava(x=x,y=y, autor=autor, text=text, strana=strana, pdf=self.pdf)
|
||||
op.save()
|
||||
self.send_email_notification_komentar(op,autor)
|
||||
elif (action == 'del'):
|
||||
|
@ -132,9 +136,8 @@ class KorekturyView(generic.TemplateView):
|
|||
kom = Komentar.objects.get(id=id)
|
||||
kom.delete()
|
||||
elif (action == 'set-state'):
|
||||
pdf = KorekturovanePDF.objects.get(id=q.get('pdf'))
|
||||
pdf.status = q.get('state') # FIXME odchytávat blbosti?
|
||||
pdf.save()
|
||||
self.pdf.status = q.get('state') # FIXME odchytávat blbosti?
|
||||
self.pdf.save()
|
||||
context = self.get_context_data()
|
||||
context['scroll'] = scroll
|
||||
context['autor'] = autor
|
||||
|
@ -193,13 +196,12 @@ class KorekturyView(generic.TemplateView):
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
pdf = get_object_or_404(KorekturovanePDF, id=self.kwargs['pdf'])
|
||||
context['pdf'] = pdf
|
||||
context['img_prefix'] = pdf.get_prefix()
|
||||
context['pdf'] = self.pdf
|
||||
context['img_prefix'] = self.pdf.get_prefix()
|
||||
context['img_path'] = settings.KOREKTURY_IMG_DIR
|
||||
context['img_indexes'] = range(pdf.stran)
|
||||
context['img_indexes'] = range(self.pdf.stran)
|
||||
context['form_oprava'] = OpravaForm()
|
||||
opravy = Oprava.objects.filter(pdf=self.kwargs['pdf'])
|
||||
opravy = Oprava.objects.filter(pdf=self.pdf_id)
|
||||
zasluhy = {}
|
||||
for o in opravy:
|
||||
if o.autor in zasluhy:
|
||||
|
|
Loading…
Reference in a new issue