Redukce modelu Pohádky

This commit is contained in:
Pavel "LEdoian" Turinsky 2019-05-30 03:18:22 +02:00
parent 7d84285e86
commit 5bba060903
3 changed files with 35 additions and 14 deletions

View file

@ -410,7 +410,7 @@ class PohadkaAdmin(VersionAdmin):
'__str__', '__str__',
'get_rocnik', 'get_rocnik',
'get_kod_ulohy', 'get_kod_ulohy',
'uloha', # 'uloha',
'autor' 'autor'
] ]

View 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',
),
]

View file

@ -876,23 +876,11 @@ class Pohadka(SeminarModelBase):
db_table = 'seminar_pohadky' db_table = 'seminar_pohadky'
verbose_name = 'Pohádka' verbose_name = 'Pohádka'
verbose_name_plural = 'Pohádky' verbose_name_plural = 'Pohádky'
ordering = ['uloha__cislo_zadani', 'uloha__kod', '-pred'] ordering = ['vytvoreno']
# Interní ID # Interní ID
id = models.AutoField(primary_key=True) 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( autor = models.ForeignKey(
Organizator, Organizator,
verbose_name="Autor pohádky", verbose_name="Autor pohádky",