Browse Source

Odstraneny nepotrebne importy.

remotes/origin/opraf
parent
commit
0b11a1b495
  1. 20
      korektury/migrations/0008_auto_20151229_1556.py
  2. 17
      korektury/models.py
  3. 23
      korektury/views.py

20
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,
),
]

17
korektury/models.py

@ -1,28 +1,13 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import random
from django.db import models from django.db import models
from django.contrib import auth
from django.utils import timezone from django.utils import timezone
from django.conf import settings from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible
from django.utils.encoding import force_unicode 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 django.core.exceptions import ObjectDoesNotExist
from imagekit.models import ImageSpecField, ProcessedImageField
from imagekit.processors import ResizeToFit, Transpose
import os
import subprocess 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 import reversion
# PrilohaReseni method # PrilohaReseni method
@ -123,13 +108,11 @@ class Oprava(models.Model):
STATUS_OPRAVENO = 'opraveno' STATUS_OPRAVENO = 'opraveno'
STATUS_NENI_CHYBA = 'neni_chyba' STATUS_NENI_CHYBA = 'neni_chyba'
STATUS_K_REAKCI = 'k_reakci' STATUS_K_REAKCI = 'k_reakci'
STATUS_SMAZANO = 'smazano'
STATUS_CHOICES = ( STATUS_CHOICES = (
(STATUS_K_OPRAVE, u'K opravě'), (STATUS_K_OPRAVE, u'K opravě'),
(STATUS_OPRAVENO, u'Opraveno'), (STATUS_OPRAVENO, u'Opraveno'),
(STATUS_NENI_CHYBA, u'Není chyba'), (STATUS_NENI_CHYBA, u'Není chyba'),
(STATUS_K_REAKCI, u'K reakci autora textu'), (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, status = models.CharField(u'stav opravy',max_length=16, choices=STATUS_CHOICES, blank=False,
default = STATUS_K_OPRAVE) default = STATUS_K_OPRAVE)

23
korektury/views.py

@ -1,24 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.shortcuts import render 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.views import generic
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.http import Http404 from django.conf import settings
from django.http import HttpResponseRedirect
from .models import Oprava,Komentar,KorekturovanePDF from .models import Oprava,Komentar,KorekturovanePDF
from .forms import OpravaForm from .forms import OpravaForm
from datetime import timedelta, date, datetime
from itertools import groupby
import tempfile
import subprocess import subprocess
import shutil import shutil
import os import os
from django.conf import settings
import unicodedata import unicodedata
class KorekturyHelpView(generic.TemplateView): class KorekturyHelpView(generic.TemplateView):
@ -116,21 +107,11 @@ class KorekturyView(generic.TemplateView):
elif (q.get('state') == u'deprecated'): elif (q.get('state') == u'deprecated'):
pdf.status = pdf.STATUS_ZASTARALE pdf.status = pdf.STATUS_ZASTARALE
pdf.save() 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 = self.get_context_data()
context['scroll'] = scroll context['scroll'] = scroll
context['autor'] = autor context['autor'] = autor
return render(request, 'korektury/opraf.html',context) 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): 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.filter(id=self.kwargs['pdf']).first()

Loading…
Cancel
Save