Pridan prototyp adminu pro konfery.
This commit is contained in:
parent
c890032255
commit
f051f62e8f
3 changed files with 50 additions and 4 deletions
|
@ -11,7 +11,7 @@ from django.db import models
|
|||
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Novinky, Organizator, Prispevek, Pohadka
|
||||
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Novinky, Organizator, Prispevek, Pohadka, Konfera
|
||||
from autocomplete_light import shortcuts as autocomplete_light
|
||||
|
||||
|
||||
|
@ -181,6 +181,7 @@ class Soustredeni_UcastniciInline(admin.TabularInline):
|
|||
qs = super(Soustredeni_UcastniciInline, self).get_queryset(request)
|
||||
return qs.select_related('resitel', 'soustredeni')
|
||||
|
||||
|
||||
class Soustredeni_OrganizatoriInline(admin.TabularInline):
|
||||
form = autocomplete_light.modelform_factory(Soustredeni_Organizatori, autocomplete_fields=['organizator'], fields=['organizator'],)
|
||||
model = Soustredeni_Organizatori
|
||||
|
@ -468,6 +469,20 @@ class SoustredeniAdmin(VersionAdmin):
|
|||
|
||||
admin.site.register(Soustredeni, SoustredeniAdmin)
|
||||
|
||||
### Konfery
|
||||
class KonferaAdminForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model=Konfera
|
||||
exclude = []
|
||||
|
||||
class KonferaAdmin(VersionAdmin):
|
||||
form = KonferaAdminForm
|
||||
list_filter = ['soustredeni']
|
||||
list_display = ['nazev','soustredeni','organizator','typ_prezentace']
|
||||
# inlines = [Konfera_UcastniciInline]
|
||||
|
||||
admin.site.register(Konfera,KonferaAdmin)
|
||||
|
||||
### Novinky
|
||||
|
||||
class NovinkyAdminForm(forms.ModelForm):
|
||||
|
|
31
seminar/migrations/0042_auto_20161005_0847.py
Normal file
31
seminar/migrations/0042_auto_20161005_0847.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import seminar.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('seminar', '0041_konfery'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='konfera',
|
||||
name='materialy',
|
||||
field=models.FileField(help_text='Dal\u0161\xed materi\xe1ly ke konfe\u0159e zabalen\xe9 do jednoho souboru', upload_to=seminar.models.generate_filename_konfera, verbose_name='materialy', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='konfera',
|
||||
name='prezentace',
|
||||
field=models.FileField(help_text='Prezentace nebo fotka posteru', upload_to=seminar.models.generate_filename_konfera, verbose_name='prezentace', blank=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='konfera',
|
||||
name='prispevek',
|
||||
field=models.ForeignKey(related_name='konfery', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='seminar.Problem', help_text='\xda\u010dastnick\xfd p\u0159\xedp\u011bvek o konfe\u0159e', null=True, verbose_name='p\u0159\xedsp\u011bvek do \u010d\xedsla'),
|
||||
),
|
||||
]
|
|
@ -859,7 +859,7 @@ class Konfera(models.Model):
|
|||
org_poznamka = models.TextField(u'neveřejná poznámka', blank=True,
|
||||
help_text=u'Neveřejná poznámka ke konfeře(plain text)')
|
||||
prispevek = models.ForeignKey(Problem, verbose_name=u'příspěvek do čísla', related_name='konfery',
|
||||
help_text=u'Účastnický přípěvek o konfeře',on_delete = models.SET_NULL, null=True)
|
||||
help_text=u'Účastnický přípěvek o konfeře',on_delete = models.SET_NULL, null=True, blank=True)
|
||||
TYP_VELETRH = 'veletrh'
|
||||
TYP_PREZENTACE = 'prezentace'
|
||||
TYP_CHOICES = [
|
||||
|
@ -868,9 +868,9 @@ class Konfera(models.Model):
|
|||
]
|
||||
typ_prezentace = models.CharField(u'typ prezentace', max_length=16, choices=TYP_CHOICES, blank=False, default=TYP_VELETRH)
|
||||
prezentace = models.FileField(u'prezentace',help_text = u'Prezentace nebo fotka posteru',
|
||||
upload_to = generate_filename_konfera)
|
||||
upload_to = generate_filename_konfera, blank=True)
|
||||
materialy = models.FileField(u'materialy',help_text = u'Další materiály ke konfeře zabalené do jednoho souboru',
|
||||
upload_to = generate_filename_konfera)
|
||||
upload_to = generate_filename_konfera, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return force_unicode(u"%s: (%s)" % (self.nazev, self.soustredeni))
|
||||
|
|
Loading…
Reference in a new issue