Priprava na odstraneni stareho Seznamu.
This commit is contained in:
parent
51ae429040
commit
5196b7a6e0
4 changed files with 125 additions and 11 deletions
|
@ -1,7 +1,16 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from reversion.admin import VersionAdmin
|
||||||
|
|
||||||
from models import Prednaska, Seznam, Hlasovani
|
from models import Prednaska, Hlasovani
|
||||||
|
|
||||||
admin.site.register(Seznam)
|
|
||||||
admin.site.register(Prednaska)
|
|
||||||
admin.site.register(Hlasovani)
|
admin.site.register(Hlasovani)
|
||||||
|
|
||||||
|
class PrednaskaAdmin(VersionAdmin):
|
||||||
|
# fieldsets = [
|
||||||
|
# (None, {'fields': ['pdf', 'cas', 'stran', 'nazev', 'komentar']}),
|
||||||
|
# ]
|
||||||
|
list_display = ['nazev', 'org', 'obor']
|
||||||
|
list_filter = ['org','obor']
|
||||||
|
search_fields = []
|
||||||
|
|
||||||
|
admin.site.register(Prednaska,PrednaskaAdmin)
|
||||||
|
|
64
prednasky/migrations/0003_auto_20160929_0117.py
Normal file
64
prednasky/migrations/0003_auto_20160929_0117.py
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('prednasky', '0002_auto_20160417_2347'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameModel(
|
||||||
|
old_name='Seznam',
|
||||||
|
new_name='Seznam_old',
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='hlasovani',
|
||||||
|
options={'ordering': ['ucastnik', 'prednaska'], 'verbose_name': 'Hlasov\xe1n\xed', 'verbose_name_plural': 'Hlasov\xe1n\xed'},
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='prednaska',
|
||||||
|
options={'ordering': ['org', 'nazev'], 'verbose_name': 'P\u0159edn\xe1\u0161ka', 'verbose_name_plural': 'P\u0159edn\xe1\u0161ky'},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='prednaska',
|
||||||
|
name='popis',
|
||||||
|
field=models.TextField(help_text=b'Neve\xc5\x99ejn\xc3\xbd popis pro ostatn\xc3\xad orgy', null=True, verbose_name=b'Popis pro orgy'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='hlasovani',
|
||||||
|
name='id',
|
||||||
|
field=models.AutoField(serialize=False, primary_key=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='prednaska',
|
||||||
|
name='anotace',
|
||||||
|
field=models.TextField(help_text=b'Ve\xc5\x99ejn\xc3\xa1 anotace v hlasov\xc3\xa1n\xc3\xad', null=True, verbose_name=b'Anotace'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='prednaska',
|
||||||
|
name='id',
|
||||||
|
field=models.AutoField(serialize=False, primary_key=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='prednaska',
|
||||||
|
name='obor',
|
||||||
|
field=models.CharField(help_text=b'Podmno\xc5\xbeina MFIOB', max_length=5, verbose_name=b'Obor'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='prednaska',
|
||||||
|
name='seznam',
|
||||||
|
field=models.ForeignKey(to='prednasky.Seznam'),
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name='hlasovani',
|
||||||
|
table='prednasky_hlasovani',
|
||||||
|
),
|
||||||
|
migrations.AlterModelTable(
|
||||||
|
name='prednaska',
|
||||||
|
table='prednasky_prednaska',
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,10 +1,27 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from seminar.models import Organizator
|
from seminar.models import Organizator,Soustredeni
|
||||||
|
|
||||||
|
CHOICES_STAV = (
|
||||||
|
(1, 'Návrh'),
|
||||||
|
(2, 'Bude')
|
||||||
|
)
|
||||||
|
|
||||||
|
class Seznam_old(models.Model):
|
||||||
|
pass
|
||||||
|
|
||||||
|
#class Seznam(models.Model):
|
||||||
|
# class Meta:
|
||||||
|
# db_table = 'prednasky_seznam'
|
||||||
|
# verbose_name = u'Seznam přednášek'
|
||||||
|
# verbose_name_plural = u'Seznamy přednášek'
|
||||||
|
# ordering = ['soustredeni', 'stav']
|
||||||
|
#
|
||||||
|
# id = models.AutoField(primary_key = True)
|
||||||
|
# soustredeni = models.ForeignKey(Soustredeni,null = True, default = None)
|
||||||
|
# stav = models.IntegerField('Stav',choices=CHOICES_STAV,default = 2)
|
||||||
|
|
||||||
class Seznam(models.Model):
|
|
||||||
pass
|
|
||||||
|
|
||||||
CHOICES_OBTIZNOST = (
|
CHOICES_OBTIZNOST = (
|
||||||
(1, 'Lehká'),
|
(1, 'Lehká'),
|
||||||
|
@ -19,15 +36,39 @@ CHOICES_BODY = (
|
||||||
)
|
)
|
||||||
|
|
||||||
class Prednaska(models.Model):
|
class Prednaska(models.Model):
|
||||||
|
class Meta:
|
||||||
|
db_table = 'prednasky_prednaska'
|
||||||
|
verbose_name = u'Přednáška'
|
||||||
|
verbose_name_plural = u'Přednášky'
|
||||||
|
ordering = ['org', 'nazev']
|
||||||
|
|
||||||
|
id = models.AutoField(primary_key = True)
|
||||||
nazev = models.CharField('Název', max_length = 300)
|
nazev = models.CharField('Název', max_length = 300)
|
||||||
org = models.ForeignKey(Organizator)
|
org = models.ForeignKey(Organizator)
|
||||||
anotace = models.TextField('Anotace')
|
popis = models.TextField('Popis pro orgy',null = True,help_text = 'Neveřejný popis pro ostatní orgy')
|
||||||
|
anotace = models.TextField('Anotace',null = True, help_text = 'Veřejná anotace v hlasování')
|
||||||
obtiznost = models.IntegerField('Obtížnost', choices=CHOICES_OBTIZNOST)
|
obtiznost = models.IntegerField('Obtížnost', choices=CHOICES_OBTIZNOST)
|
||||||
obor = models.CharField('Obor', max_length = 5)
|
obor = models.CharField('Obor', max_length = 5, help_text = 'Podmnožina MFIOB')
|
||||||
klicova = models.CharField('Klíčová slova', max_length = 200, null = True, blank = True)
|
klicova = models.CharField('Klíčová slova', max_length = 200, null = True, blank = True)
|
||||||
seznam = models.ForeignKey(Seznam, blank = True, default = None)
|
seznam = models.ForeignKey(Seznam_old)
|
||||||
|
|
||||||
|
#class Prednaska_Seznam(models.Model):
|
||||||
|
# class Meta:
|
||||||
|
# db_table = 'prednasky_prednaska_seznam'
|
||||||
|
# verbose_name = u'Přednáška v seznamu'
|
||||||
|
# verbose_name_plural = u'Přednášky v seznamech'
|
||||||
|
# id = models.AutoField(primary_key = True)
|
||||||
|
# prednaska = models.ForeignKey(Prednaska)
|
||||||
|
# seznam = models.ForeignKey(Seznam)
|
||||||
|
#
|
||||||
|
|
||||||
class Hlasovani(models.Model):
|
class Hlasovani(models.Model):
|
||||||
|
class Meta:
|
||||||
|
db_table = 'prednasky_hlasovani'
|
||||||
|
verbose_name = u'Hlasování'
|
||||||
|
verbose_name_plural = u'Hlasování'
|
||||||
|
ordering = ['ucastnik', 'prednaska']
|
||||||
|
id = models.AutoField(primary_key = True)
|
||||||
prednaska = models.ForeignKey(Prednaska)
|
prednaska = models.ForeignKey(Prednaska)
|
||||||
body = models.IntegerField('Body', default = 0, choices = CHOICES_BODY)
|
body = models.IntegerField('Body', default = 0, choices = CHOICES_BODY)
|
||||||
ucastnik = models.CharField('Účastník', max_length = 100)
|
ucastnik = models.CharField('Účastník', max_length = 100)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from prednasky.forms import NewPrednaskyForm
|
from prednasky.forms import NewPrednaskyForm
|
||||||
from prednasky.models import Seznam, Hlasovani, Prednaska
|
from prednasky.models import Seznam_old, Hlasovani, Prednaska
|
||||||
from django.shortcuts import HttpResponseRedirect
|
from django.shortcuts import HttpResponseRedirect
|
||||||
|
|
||||||
def newPrednaska(request):
|
def newPrednaska(request):
|
||||||
# zjistime k jakemu soustredeni se vaze nove vytvarena galerie
|
# zjistime k jakemu soustredeni se vaze nove vytvarena galerie
|
||||||
prednasky = Seznam.objects.first()
|
prednasky = Seznam_old.objects.first()
|
||||||
# obsluha formulare umoznujiciho multiple nahravani fotek
|
# obsluha formulare umoznujiciho multiple nahravani fotek
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = NewPrednaskyForm(request.POST, request.FILES)
|
form = NewPrednaskyForm(request.POST, request.FILES)
|
||||||
|
|
Loading…
Reference in a new issue