Web M&M
https://mam.matfyz.cz
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.9 KiB
56 lines
1.9 KiB
# -*- coding: utf-8 -*-
|
|
from django.shortcuts import render
|
|
from django.shortcuts import get_object_or_404, render
|
|
from django.http import HttpResponseRedirect
|
|
from django.http import HttpResponse
|
|
from django.core.urlresolvers import reverse
|
|
from django.views import generic
|
|
from django.utils.translation import ugettext as _
|
|
from django.http import Http404
|
|
from django.http import HttpResponseRedirect
|
|
|
|
from .models import Oprava
|
|
from .forms import OpravaForm
|
|
|
|
from datetime import timedelta, date, datetime
|
|
from itertools import groupby
|
|
import tempfile
|
|
import subprocess
|
|
import shutil
|
|
import os
|
|
from django.conf import settings
|
|
import unicodedata
|
|
|
|
### Korektury
|
|
class KorekturyView(generic.TemplateView):
|
|
model = Oprava
|
|
template_name = 'korektury/opraf.html'
|
|
form_class = OpravaForm
|
|
|
|
def post(self, request, *args, **kwargs):
|
|
form = self.form_class(request.POST)
|
|
q = request.POST
|
|
x = int(q.get('x'))
|
|
y = int(q.get('y'))
|
|
autor = q.get('au')
|
|
text = q.get('txt')
|
|
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()
|
|
|
|
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))
|
|
def get_context_data(self, **kwargs):
|
|
context = super(KorekturyView,self).get_context_data(**kwargs)
|
|
context['img_name'] = "22_3_verze5"
|
|
context['img_indexes'] = range(27)
|
|
context['form_oprava'] = OpravaForm()
|
|
context['opravy'] = Oprava.objects.all()
|
|
return context
|
|
def form_valid(self,form):
|
|
return super(KorekturyView,self).form_valid(form)
|
|
|
|
|