Browse Source

Form se nikde nepoužívá

korekturovatko
Jonas Havelka 3 weeks ago
parent
commit
d3d5484d0e
  1. 14
      korektury/forms.py
  2. 7
      korektury/views.py

14
korektury/forms.py

@ -1,14 +0,0 @@
from django import forms
class OpravaForm(forms.Form):
""" formulář k přidání opravy (:class:`korektury.models.Oprava`) """
text = forms.CharField(max_length=256)
autor = forms.CharField(max_length=20)
x = forms.IntegerField()
y = forms.IntegerField()
scroll = forms.CharField(max_length=256)
pdf = forms.CharField(max_length=256)
img_id = forms.CharField(max_length=256)
id = forms.CharField(max_length=256)
action = forms.CharField(max_length=256)

7
korektury/views.py

@ -6,7 +6,6 @@ from django.core.mail import EmailMessage
from django.db.models import Count,Q
from .models import Oprava,Komentar,KorekturovanePDF, Organizator
from .forms import OpravaForm
class KorekturyListView(generic.ListView):
model = KorekturovanePDF
@ -54,7 +53,6 @@ class KorekturySeskupeneListView(KorekturyAktualniListView):
class KorekturyView(generic.TemplateView):
model = Oprava
template_name = 'korektury/opraf.html'
form_class = OpravaForm
def setup(self, request, *args, **kwargs):
super().setup(request, *args, **kwargs)
@ -62,7 +60,6 @@ class KorekturyView(generic.TemplateView):
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
scroll = q.get('scroll')
@ -200,7 +197,6 @@ class KorekturyView(generic.TemplateView):
context['img_prefix'] = self.pdf.get_prefix()
context['img_path'] = settings.KOREKTURY_IMG_DIR
context['img_indexes'] = range(self.pdf.stran)
context['form_oprava'] = OpravaForm()
opravy = Oprava.objects.filter(pdf=self.pdf_id)
zasluhy = {}
for o in opravy:
@ -233,6 +229,3 @@ class KorekturyView(generic.TemplateView):
context['zasluhy'] = zasluhy
return context
def form_valid(self,form):
return super().form_valid(form)

Loading…
Cancel
Save