diff --git a/korektury/migrations/0008_auto_20151229_1556.py b/korektury/migrations/0008_auto_20151229_1556.py new file mode 100644 index 00000000..50e28379 --- /dev/null +++ b/korektury/migrations/0008_auto_20151229_1556.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('korektury', '0007_auto_20151225_1237'), + ] + + operations = [ + migrations.AlterField( + model_name='oprava', + name='status', + field=models.CharField(default=b'k_oprave', max_length=16, verbose_name='stav opravy', choices=[(b'k_oprave', 'K oprav\u011b'), (b'opraveno', 'Opraveno'), (b'neni_chyba', 'Nen\xed chyba'), (b'k_reakci', 'K reakci autora textu')]), + preserve_default=True, + ), + ] diff --git a/korektury/models.py b/korektury/models.py index ee873616..f69196f6 100644 --- a/korektury/models.py +++ b/korektury/models.py @@ -1,28 +1,13 @@ # -*- coding: utf-8 -*- import os -import random from django.db import models -from django.contrib import auth from django.utils import timezone from django.conf import settings from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import force_unicode -from django.utils.text import slugify -from django.core.urlresolvers import reverse -from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist -from imagekit.models import ImageSpecField, ProcessedImageField -from imagekit.processors import ResizeToFit, Transpose -import os import subprocess -from cStringIO import StringIO -from django.core.files.base import ContentFile - -from django_countries.fields import CountryField -from solo.models import SingletonModel -from taggit.managers import TaggableManager - import reversion # PrilohaReseni method @@ -123,13 +108,11 @@ class Oprava(models.Model): STATUS_OPRAVENO = 'opraveno' STATUS_NENI_CHYBA = 'neni_chyba' STATUS_K_REAKCI = 'k_reakci' - STATUS_SMAZANO = 'smazano' STATUS_CHOICES = ( (STATUS_K_OPRAVE, u'K opravě'), (STATUS_OPRAVENO, u'Opraveno'), (STATUS_NENI_CHYBA, u'Není chyba'), (STATUS_K_REAKCI, u'K reakci autora textu'), - (STATUS_SMAZANO, u'Smazáno'), ) status = models.CharField(u'stav opravy',max_length=16, choices=STATUS_CHOICES, blank=False, default = STATUS_K_OPRAVE) diff --git a/korektury/views.py b/korektury/views.py index 6b77f61e..d2f0ff3a 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -1,24 +1,15 @@ # -*- 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 django.conf import settings from .models import Oprava,Komentar,KorekturovanePDF 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 class KorekturyHelpView(generic.TemplateView): @@ -116,21 +107,11 @@ class KorekturyView(generic.TemplateView): elif (q.get('state') == u'deprecated'): pdf.status = pdf.STATUS_ZASTARALE pdf.save() - - - - -# return HttpResponse(u'Keys: %s '%(q.iteitems())) -# return HttpResponse(u'Oprav: %d, akce: %s'%( -# len(Oprava.objects.all()),action)) - -# return HttpResponseRedirect(reverse('korektury')+"?scroll=%s"%(scroll)) context = self.get_context_data() context['scroll'] = scroll context['autor'] = autor return render(request, 'korektury/opraf.html',context) -# 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) pdf = KorekturovanePDF.objects.filter(id=self.kwargs['pdf']).first()