Indexy a unikatnost pro rocnik a cislo
This commit is contained in:
parent
7fac56f29a
commit
79ea541587
2 changed files with 48 additions and 4 deletions
44
seminar/migrations/0020_indexy_a_razeni.py
Normal file
44
seminar/migrations/0020_indexy_a_razeni.py
Normal file
|
@ -0,0 +1,44 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('seminar', '0019_rocnik_ciselne'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='cislo',
|
||||
options={'ordering': ['-rocnik__rocnik', '-cislo'], 'verbose_name': '\u010c\xedslo', 'verbose_name_plural': '\u010c\xedsla'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='reseni',
|
||||
options={'ordering': ['problem_id', 'resitel__prijmeni', 'resitel__jmeno'], 'verbose_name': '\u0158e\u0161en\xed', 'verbose_name_plural': '\u0158e\u0161en\xed'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='rocnik',
|
||||
options={'ordering': ['-rocnik'], 'verbose_name': 'Ro\u010dn\xedk', 'verbose_name_plural': 'Ro\u010dn\xedky'},
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='cislo',
|
||||
name='cislo',
|
||||
field=models.CharField(help_text='V\u011bt\u0161inou jen "1", vyj\xedme\u010dn\u011b "7-8", lexikograficky ur\u010dije po\u0159ad\xed v ro\u010dn\xedku!', max_length=32, verbose_name='n\xe1zev \u010d\xedsla', db_index=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='rocnik',
|
||||
name='prvni_rok',
|
||||
field=models.IntegerField(unique=True, verbose_name='prvn\xed rok', db_index=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='rocnik',
|
||||
name='rocnik',
|
||||
field=models.IntegerField(unique=True, verbose_name='\u010d\xedslo ro\u010dn\xedku', db_index=True),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
|
@ -196,9 +196,9 @@ class Rocnik(SeminarModelBase):
|
|||
# Interní ID
|
||||
id = models.AutoField(primary_key = True)
|
||||
|
||||
prvni_rok = models.IntegerField(u'první rok')
|
||||
prvni_rok = models.IntegerField(u'první rok', db_index=True, unique=True)
|
||||
|
||||
rocnik = models.IntegerField(u'číslo ročníku')
|
||||
rocnik = models.IntegerField(u'číslo ročníku', db_index=True, unique=True)
|
||||
|
||||
def __str__(self):
|
||||
return force_unicode(u'%s (%d/%d)' % (self.rocnik, self.prvni_rok, self.prvni_rok+1))
|
||||
|
@ -249,9 +249,9 @@ class Cislo(SeminarModelBase):
|
|||
# Interní ID
|
||||
id = models.AutoField(primary_key = True)
|
||||
|
||||
rocnik = models.ForeignKey(Rocnik, verbose_name=u'ročník', related_name='cisla')
|
||||
rocnik = models.ForeignKey(Rocnik, verbose_name=u'ročník', related_name='cisla', db_index=True)
|
||||
|
||||
cislo = models.CharField(u'název čísla', max_length=32,
|
||||
cislo = models.CharField(u'název čísla', max_length=32, db_index=True,
|
||||
help_text=u'Většinou jen "1", vyjímečně "7-8", lexikograficky určije pořadí v ročníku!')
|
||||
|
||||
datum_vydani = models.DateField(u'datum vydání', blank=True, null=True,
|
||||
|
|
Loading…
Reference in a new issue