Merge branch 'master' into stable
This commit is contained in:
commit
23780af908
4 changed files with 52 additions and 11 deletions
|
@ -2,15 +2,18 @@ from django.contrib import admin
|
||||||
from reversion.admin import VersionAdmin
|
from reversion.admin import VersionAdmin
|
||||||
from korektury.models import KorekturovanePDF
|
from korektury.models import KorekturovanePDF
|
||||||
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
class KorekturovanePDFAdmin(VersionAdmin):
|
class KorekturovanePDFAdmin(VersionAdmin):
|
||||||
readonly_fields = ['cas', 'stran']
|
readonly_fields = ['cas', 'stran']
|
||||||
fieldsets = [
|
fieldsets = [
|
||||||
(None, {'fields': ['pdf', 'cas', 'stran', 'nazev', 'komentar']}),
|
(None,
|
||||||
# (u'PDF', {'fields': ['pdf']}),
|
{'fields':
|
||||||
]
|
['pdf', 'cas', 'org', 'stran', 'nazev', 'komentar']}),
|
||||||
list_display = ['nazev', 'cas', 'stran']
|
# (u'PDF', {'fields': ['pdf']}),
|
||||||
list_filter = []
|
]
|
||||||
search_fields = []
|
list_display = ['nazev', 'cas', 'stran']
|
||||||
|
list_filter = []
|
||||||
|
search_fields = []
|
||||||
|
|
||||||
admin.site.register(KorekturovanePDF, KorekturovanePDFAdmin)
|
admin.site.register(KorekturovanePDF, KorekturovanePDFAdmin)
|
||||||
|
|
25
korektury/migrations/0014_add_org_to_pdf.py
Normal file
25
korektury/migrations/0014_add_org_to_pdf.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('seminar', '0041_konfery'),
|
||||||
|
('korektury', '0013_rename_autor_org'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='korekturovanepdf',
|
||||||
|
name='org',
|
||||||
|
field=models.ForeignKey(default=None,
|
||||||
|
blank=True,
|
||||||
|
to='seminar.Organizator',
|
||||||
|
help_text=b'Zodpov\xc4\x9bdn\xc3\xbd\
|
||||||
|
organiz\xc3\xa1tor za obsah',
|
||||||
|
null=True),
|
||||||
|
),
|
||||||
|
]
|
|
@ -48,7 +48,13 @@ class KorekturovanePDF(models.Model):
|
||||||
|
|
||||||
pdf = models.FileField(u'PDF', upload_to = generate_filename)
|
pdf = models.FileField(u'PDF', upload_to = generate_filename)
|
||||||
|
|
||||||
stran = models.IntegerField(u'počet stran', help_text = 'Počet stran PDF', default = 0)
|
org = models.ForeignKey(Organizator, blank=True,
|
||||||
|
help_text='Zodpovědný organizátor za obsah',
|
||||||
|
null=True,
|
||||||
|
default=None)
|
||||||
|
|
||||||
|
stran = models.IntegerField(u'počet stran', help_text='Počet stran PDF',
|
||||||
|
default=0)
|
||||||
STATUS_PRIDAVANI = 'pridavani'
|
STATUS_PRIDAVANI = 'pridavani'
|
||||||
STATUS_ZANASENI = 'zanaseni'
|
STATUS_ZANASENI = 'zanaseni'
|
||||||
STATUS_ZASTARALE = 'zastarale'
|
STATUS_ZASTARALE = 'zastarale'
|
||||||
|
|
|
@ -52,6 +52,7 @@ class KorekturyView(generic.TemplateView):
|
||||||
|
|
||||||
op = Oprava(x=x,y=y, autor=autor, text=text, strana=strana,pdf = pdf)
|
op = Oprava(x=x,y=y, autor=autor, text=text, strana=strana,pdf = pdf)
|
||||||
op.save()
|
op.save()
|
||||||
|
self.send_email_notification_komentar(op, autor, text)
|
||||||
elif (action == u'del'):
|
elif (action == u'del'):
|
||||||
id = int(q.get('id'))
|
id = int(q.get('id'))
|
||||||
op = Oprava.objects.get(id=id)
|
op = Oprava.objects.get(id=id)
|
||||||
|
@ -135,13 +136,19 @@ class KorekturyView(generic.TemplateView):
|
||||||
# Prijemci e-mailu
|
# Prijemci e-mailu
|
||||||
emails = set()
|
emails = set()
|
||||||
email = oprava.autor.user.email
|
email = oprava.autor.user.email
|
||||||
|
# e-mail autora opravy (TODO odstranit z prijemcu)
|
||||||
if email:
|
if email:
|
||||||
emails.add(email)
|
emails.add(email)
|
||||||
|
# nalezeni e-mailu na organizatory komentaru
|
||||||
for komentar in oprava.komentar_set.all():
|
for komentar in oprava.komentar_set.all():
|
||||||
email = komentar.autor.user.email
|
email = komentar.autor.user.email
|
||||||
if email:
|
if email:
|
||||||
emails.add(email)
|
emails.add(email)
|
||||||
|
# zodpovedny org
|
||||||
|
email_zobpovedny = oprava.pdf.org.user.email
|
||||||
|
if email_zobpovedny:
|
||||||
|
emails.add(email_zobpovedny)
|
||||||
|
|
||||||
send_mail(subject, text, from_email, list(emails))
|
send_mail(subject, text, from_email, list(emails))
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue