|
@ -43,52 +43,52 @@ 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.filter(id=q.get('pdf')).first() |
|
|
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 = pdf) |
|
|
op.save() |
|
|
op.save() |
|
|
elif (action == u'del'): |
|
|
elif (action == u'del'): |
|
|
id = int(q.get('id')) |
|
|
id = int(q.get('id')) |
|
|
op = Oprava.objects.filter(id=id).first() |
|
|
op = Oprava.objects.get(id=id) |
|
|
op.delete() |
|
|
op.delete() |
|
|
elif (action == u'update'): |
|
|
elif (action == u'update'): |
|
|
id = int(q.get('id')) |
|
|
id = int(q.get('id')) |
|
|
op = Oprava.objects.filter(id=id).first() |
|
|
op = Oprava.objects.get(id=id) |
|
|
text = q.get('txt') |
|
|
text = q.get('txt') |
|
|
op.autor = autor |
|
|
op.autor = autor |
|
|
op.text = text |
|
|
op.text = text |
|
|
op.save() |
|
|
op.save() |
|
|
elif (action == u'undone'): |
|
|
elif (action == u'undone'): |
|
|
id = int(q.get('id')) |
|
|
id = int(q.get('id')) |
|
|
op = Oprava.objects.filter(id=id).first() |
|
|
op = Oprava.objects.get(id=id) |
|
|
op.status = op.STATUS_K_OPRAVE |
|
|
op.status = op.STATUS_K_OPRAVE |
|
|
op.save() |
|
|
op.save() |
|
|
elif (action == u'done'): |
|
|
elif (action == u'done'): |
|
|
id = int(q.get('id')) |
|
|
id = int(q.get('id')) |
|
|
op = Oprava.objects.filter(id=id).first() |
|
|
op = Oprava.objects.get(id=id) |
|
|
op.status = op.STATUS_OPRAVENO |
|
|
op.status = op.STATUS_OPRAVENO |
|
|
op.save() |
|
|
op.save() |
|
|
elif (action == u'wontfix'): |
|
|
elif (action == u'wontfix'): |
|
|
id = int(q.get('id')) |
|
|
id = int(q.get('id')) |
|
|
op = Oprava.objects.filter(id=id).first() |
|
|
op = Oprava.objects.get(id=id) |
|
|
op.status = op.STATUS_NENI_CHYBA |
|
|
op.status = op.STATUS_NENI_CHYBA |
|
|
op.save() |
|
|
op.save() |
|
|
elif (action == u'comment'): |
|
|
elif (action == u'comment'): |
|
|
id = int(q.get('id')) |
|
|
id = int(q.get('id')) |
|
|
op = Oprava.objects.filter(id=id).first() |
|
|
op = Oprava.objects.get(id=id) |
|
|
text = q.get('txt') |
|
|
text = q.get('txt') |
|
|
kom = Komentar(oprava=op,autor=autor,text=text) |
|
|
kom = Komentar(oprava=op,autor=autor,text=text) |
|
|
kom.save() |
|
|
kom.save() |
|
|
elif (action == u'update-comment'): |
|
|
elif (action == u'update-comment'): |
|
|
id = int(q.get('id')) |
|
|
id = int(q.get('id')) |
|
|
kom = Komentar.objects.filter(id=id).first() |
|
|
kom = Komentar.objects.get(id=id) |
|
|
text = q.get('txt') |
|
|
text = q.get('txt') |
|
|
kom.text = text |
|
|
kom.text = text |
|
|
kom.autor = autor |
|
|
kom.autor = autor |
|
|
kom.save() |
|
|
kom.save() |
|
|
elif (action == u'del-comment'): |
|
|
elif (action == u'del-comment'): |
|
|
id = int(q.get('id')) |
|
|
id = int(q.get('id')) |
|
|
kom = Komentar.objects.filter(id=id).first() |
|
|
kom = Komentar.objects.get(id=id) |
|
|
kom.delete() |
|
|
kom.delete() |
|
|
elif (action == u'delall'): |
|
|
elif (action == u'delall'): |
|
|
pdf = KorekturovanePDF.objects.filter(id=q.get('pdf')) |
|
|
pdf = KorekturovanePDF.objects.filter(id=q.get('pdf')) |
|
@ -114,7 +114,7 @@ class KorekturyView(generic.TemplateView): |
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
def get_context_data(self, **kwargs): |
|
|
context = super(KorekturyView,self).get_context_data(**kwargs) |
|
|
context = super(KorekturyView,self).get_context_data(**kwargs) |
|
|
pdf = KorekturovanePDF.objects.filter(id=self.kwargs['pdf']).first() |
|
|
pdf = KorekturovanePDF.objects.get(id=self.kwargs['pdf']) |
|
|
context['pdf'] = pdf |
|
|
context['pdf'] = pdf |
|
|
context['img_name'] = os.path.split(pdf.pdf.path)[1].split('.')[0] |
|
|
context['img_name'] = os.path.split(pdf.pdf.path)[1].split('.')[0] |
|
|
context['img_path'] = settings.KOREKTURY_IMG_DIR |
|
|
context['img_path'] = settings.KOREKTURY_IMG_DIR |
|
|