Models: Polymorphizován Problem
This commit is contained in:
parent
d9daca0358
commit
d64214c75d
3 changed files with 42 additions and 1 deletions
20
seminar/migrations/0002_treenode_polymorphic_ctype.py
Normal file
20
seminar/migrations/0002_treenode_polymorphic_ctype.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 2.2.4 on 2019-08-13 19:36
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('contenttypes', '0002_remove_content_type_name'),
|
||||||
|
('seminar', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='treenode',
|
||||||
|
name='polymorphic_ctype',
|
||||||
|
field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_seminar.treenode_set+', to='contenttypes.ContentType'),
|
||||||
|
),
|
||||||
|
]
|
20
seminar/migrations/0003_problem_polymorphic_ctype.py
Normal file
20
seminar/migrations/0003_problem_polymorphic_ctype.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
# Generated by Django 2.2.4 on 2019-08-13 19:45
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('contenttypes', '0002_remove_content_type_name'),
|
||||||
|
('seminar', '0002_treenode_polymorphic_ctype'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='problem',
|
||||||
|
name='polymorphic_ctype',
|
||||||
|
field=models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_seminar.problem_set+', to='contenttypes.ContentType'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -584,7 +584,8 @@ class Soustredeni(SeminarModelBase):
|
||||||
|
|
||||||
|
|
||||||
@reversion.register(ignore_duplicates=True)
|
@reversion.register(ignore_duplicates=True)
|
||||||
class Problem(SeminarModelBase):
|
# Pozor na následující řádek. *Nekrmit, asi kouše!*
|
||||||
|
class Problem(SeminarModelBase,PolymorphicModel):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
# Není abstraktní, protože se na něj jinak nedají dělat ForeignKeys.
|
# Není abstraktní, protože se na něj jinak nedají dělat ForeignKeys.
|
||||||
|
|
Loading…
Reference in a new issue