|
@ -25,7 +25,7 @@ def fix_ctypes(parent: str, children, apps, schema_editor): |
|
|
# Ostatní instance mají mít explicitně content type pro rodiče |
|
|
# Ostatní instance mají mít explicitně content type pro rodiče |
|
|
new_ct = ContentType.objects.get_for_model(Parent) |
|
|
new_ct = ContentType.objects.get_for_model(Parent) |
|
|
for obj in Parent.objects.filter(polymorphic_ctype__isnull=True): |
|
|
for obj in Parent.objects.filter(polymorphic_ctype__isnull=True): |
|
|
log.warn(f"{parent} {obj} neměl content type -- nejspíš to je instance přímo {parent}!") |
|
|
log.warn(f"{parent} \"{obj}\" neměl content type -- nejspíš to je instance přímo {parent}!") |
|
|
obj.polymorphic_ctype=new_ct |
|
|
obj.polymorphic_ctype=new_ct |
|
|
obj.save() |
|
|
obj.save() |
|
|
|
|
|
|
|
@ -36,7 +36,7 @@ def fix_treenode(apps, schema_editor): |
|
|
fix_ctypes("TreeNode", children, apps, schema_editor) |
|
|
fix_ctypes("TreeNode", children, apps, schema_editor) |
|
|
|
|
|
|
|
|
def fix_problem(apps, schema_editor): |
|
|
def fix_problem(apps, schema_editor): |
|
|
children = ['Tema', 'Clanek', 'Uloha', 'Konfera'] |
|
|
children = ['Tema', 'Clanek', 'Uloha'] # FIXME: Konfera z nějakého důvodu tenhle field vůbec nemá, asi je to špatně. |
|
|
fix_ctypes("Problem", children, apps, schema_editor) |
|
|
fix_ctypes("Problem", children, apps, schema_editor) |
|
|
|
|
|
|
|
|
class Migration(migrations.Migration): |
|
|
class Migration(migrations.Migration): |
|
|