Redukce modelu Pohádky
This commit is contained in:
parent
7d84285e86
commit
5bba060903
3 changed files with 35 additions and 14 deletions
|
@ -410,7 +410,7 @@ class PohadkaAdmin(VersionAdmin):
|
|||
'__str__',
|
||||
'get_rocnik',
|
||||
'get_kod_ulohy',
|
||||
'uloha',
|
||||
# 'uloha',
|
||||
'autor'
|
||||
]
|
||||
|
||||
|
|
33
seminar/migrations/0062_redukce_modelu_pohadky.py
Normal file
33
seminar/migrations/0062_redukce_modelu_pohadky.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.20 on 2019-05-30 01:16
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('seminar', '0061_kill_frankenstein'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='pohadka',
|
||||
options={'ordering': ['vytvoreno'], 'verbose_name': 'Pohádka', 'verbose_name_plural': 'Pohádky'},
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='pohadka',
|
||||
name='pred',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='pohadka',
|
||||
name='text',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='pohadka',
|
||||
name='uloha',
|
||||
),
|
||||
]
|
|
@ -876,23 +876,11 @@ class Pohadka(SeminarModelBase):
|
|||
db_table = 'seminar_pohadky'
|
||||
verbose_name = 'Pohádka'
|
||||
verbose_name_plural = 'Pohádky'
|
||||
ordering = ['uloha__cislo_zadani', 'uloha__kod', '-pred']
|
||||
ordering = ['vytvoreno']
|
||||
|
||||
# Interní ID
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
||||
text = models.TextField('Text pohádky')
|
||||
uloha = models.ForeignKey(
|
||||
Uloha,
|
||||
verbose_name='Úloha',
|
||||
related_name='pohadky',
|
||||
null=True
|
||||
)
|
||||
|
||||
# Kusů pohádky je v čísle obvykle o 1 více, než úloh. Jeden bude za úlohou
|
||||
# místo před ní.
|
||||
pred = models.BooleanField('Před úlohou', default=True)
|
||||
|
||||
autor = models.ForeignKey(
|
||||
Organizator,
|
||||
verbose_name="Autor pohádky",
|
||||
|
|
Loading…
Reference in a new issue