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