Browse Source

Models: Polymorphizován Problem

export_seznamu_prednasek
Pavel "LEdoian" Turinsky 5 years ago
parent
commit
d64214c75d
  1. 20
      seminar/migrations/0002_treenode_polymorphic_ctype.py
  2. 20
      seminar/migrations/0003_problem_polymorphic_ctype.py
  3. 3
      seminar/models.py

20
seminar/migrations/0002_treenode_polymorphic_ctype.py

@ -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

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

3
seminar/models.py

@ -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…
Cancel
Save