|
|
@ -30,6 +30,10 @@ class KorekturyView(generic.TemplateView): |
|
|
|
def post(self, request, *args, **kwargs): |
|
|
|
form = self.form_class(request.POST) |
|
|
|
q = request.POST |
|
|
|
|
|
|
|
|
|
|
|
action = q.get('action') |
|
|
|
if (action == u''): # Přidej |
|
|
|
x = int(q.get('x')) |
|
|
|
y = int(q.get('y')) |
|
|
|
autor = q.get('au') |
|
|
@ -37,10 +41,35 @@ class KorekturyView(generic.TemplateView): |
|
|
|
strana = int(q.get('img-id')[4:]) |
|
|
|
scroll = q.get('scroll') |
|
|
|
|
|
|
|
oprava = Oprava(x=x,y=y, autor=autor, text=text, strana=strana) |
|
|
|
oprava.save() |
|
|
|
op = Oprava(x=x,y=y, autor=autor, text=text, strana=strana) |
|
|
|
op.save() |
|
|
|
elif (action == u'del'): |
|
|
|
id = int(q.get('id')) |
|
|
|
op = Oprava.objects.filter(id=id).first() |
|
|
|
op.delete() |
|
|
|
elif (action == u'update'): |
|
|
|
id = int(q.get('id')) |
|
|
|
op = Oprava.objects.filter(id=id).first() |
|
|
|
autor = q.get('au') |
|
|
|
text = q.get('txt') |
|
|
|
op.autor = autor |
|
|
|
op.text = text |
|
|
|
op.save() |
|
|
|
elif (action == u'undone'): |
|
|
|
id = int(q.get('id')) |
|
|
|
op = Oprava.objects.filter(id=id).first() |
|
|
|
op.status = op.STATUS_K_OPRAVE |
|
|
|
op.save() |
|
|
|
elif (action == u'done'): |
|
|
|
id = int(q.get('id')) |
|
|
|
op = Oprava.objects.filter(id=id).first() |
|
|
|
op.status = op.STATUS_OPRAVENO |
|
|
|
op.save() |
|
|
|
|
|
|
|
return HttpResponse(u'Oprav: %d, akce: %s'%( |
|
|
|
len(Oprava.objects.all()),action)) |
|
|
|
|
|
|
|
return HttpResponseRedirect(reverse('korektury')+"?scroll=%s"%(scroll)) |
|
|
|
# return HttpResponseRedirect(reverse('korektury')+"?scroll=%s"%(scroll)) |
|
|
|
# return render(request, 'seminar/opraf.html',self.get_context_data()) |
|
|
|
# return HttpResponse(u'Oprav: %d,x: %d y: %d, autor: %s, text: %s, strana: %d'%( |
|
|
|
# len(Oprava.objects.all()),x,y,autor,text,strana)) |
|
|
|