Migrace na novy model.
Predchozi commit nefunguje, pouzijte tento.
This commit is contained in:
parent
5196b7a6e0
commit
c803014e77
5 changed files with 92 additions and 25 deletions
|
@ -51,7 +51,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='prednaska',
|
model_name='prednaska',
|
||||||
name='seznam',
|
name='seznam',
|
||||||
field=models.ForeignKey(to='prednasky.Seznam'),
|
field=models.ForeignKey(to='prednasky.Seznam_old'),
|
||||||
),
|
),
|
||||||
migrations.AlterModelTable(
|
migrations.AlterModelTable(
|
||||||
name='hlasovani',
|
name='hlasovani',
|
||||||
|
|
18
prednasky/migrations/0004_remove_prednaska_seznam.py
Normal file
18
prednasky/migrations/0004_remove_prednaska_seznam.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('prednasky', '0003_auto_20160929_0117'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='prednaska',
|
||||||
|
name='seznam',
|
||||||
|
),
|
||||||
|
]
|
49
prednasky/migrations/0005_auto_20160929_0153.py
Normal file
49
prednasky/migrations/0005_auto_20160929_0153.py
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('seminar', '0041_konfery'),
|
||||||
|
('prednasky', '0004_remove_prednaska_seznam'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Prednaska_Seznam',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(serialize=False, primary_key=True)),
|
||||||
|
('prednaska', models.ForeignKey(to='prednasky.Prednaska')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'db_table': 'prednasky_prednaska_seznam',
|
||||||
|
'verbose_name': 'P\u0159edn\xe1\u0161ka v seznamu',
|
||||||
|
'verbose_name_plural': 'P\u0159edn\xe1\u0161ky v seznamech',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Seznam',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(serialize=False, primary_key=True)),
|
||||||
|
('stav', models.IntegerField(default=2, verbose_name=b'Stav', choices=[(1, b'N\xc3\xa1vrh'), (2, b'Bude')])),
|
||||||
|
('soustredeni', models.ForeignKey(default=None, to='seminar.Soustredeni', null=True)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ['soustredeni', 'stav'],
|
||||||
|
'db_table': 'prednasky_seznam',
|
||||||
|
'verbose_name': 'Seznam p\u0159edn\xe1\u0161ek',
|
||||||
|
'verbose_name_plural': 'Seznamy p\u0159edn\xe1\u0161ek',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='Seznam_old',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='prednaska_seznam',
|
||||||
|
name='seznam',
|
||||||
|
field=models.ForeignKey(to='prednasky.Seznam'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -8,19 +8,19 @@ CHOICES_STAV = (
|
||||||
(2, 'Bude')
|
(2, 'Bude')
|
||||||
)
|
)
|
||||||
|
|
||||||
class Seznam_old(models.Model):
|
#class Seznam_old(models.Model):
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
#class Seznam(models.Model):
|
class Seznam(models.Model):
|
||||||
# class Meta:
|
class Meta:
|
||||||
# db_table = 'prednasky_seznam'
|
db_table = 'prednasky_seznam'
|
||||||
# verbose_name = u'Seznam přednášek'
|
verbose_name = u'Seznam přednášek'
|
||||||
# verbose_name_plural = u'Seznamy přednášek'
|
verbose_name_plural = u'Seznamy přednášek'
|
||||||
# ordering = ['soustredeni', 'stav']
|
ordering = ['soustredeni', 'stav']
|
||||||
#
|
|
||||||
# id = models.AutoField(primary_key = True)
|
id = models.AutoField(primary_key = True)
|
||||||
# soustredeni = models.ForeignKey(Soustredeni,null = True, default = None)
|
soustredeni = models.ForeignKey(Soustredeni,null = True, default = None)
|
||||||
# stav = models.IntegerField('Stav',choices=CHOICES_STAV,default = 2)
|
stav = models.IntegerField('Stav',choices=CHOICES_STAV,default = 2)
|
||||||
|
|
||||||
|
|
||||||
CHOICES_OBTIZNOST = (
|
CHOICES_OBTIZNOST = (
|
||||||
|
@ -50,17 +50,17 @@ class Prednaska(models.Model):
|
||||||
obtiznost = models.IntegerField('Obtížnost', choices=CHOICES_OBTIZNOST)
|
obtiznost = models.IntegerField('Obtížnost', choices=CHOICES_OBTIZNOST)
|
||||||
obor = models.CharField('Obor', max_length = 5, help_text = 'Podmnožina MFIOB')
|
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_old)
|
# 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 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:
|
class Meta:
|
||||||
|
|
|
@ -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_old, Hlasovani, Prednaska
|
from prednasky.models import Seznam, 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_old.objects.first()
|
prednasky = Seznam.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