Browse Source

Fix migrace: cislo_body může být None

pull/3/head
Jonas Havelka 2 years ago
parent
commit
ffab712aec
  1. 2
      seminar/migrations/0104_hodnoceni_deadline_body.py

2
seminar/migrations/0104_hodnoceni_deadline_body.py

@ -11,7 +11,7 @@ def prirad_deadliny(apps, schema_editor):
Deadline = apps.get_model('seminar', 'Deadline') Deadline = apps.get_model('seminar', 'Deadline')
for h in Hodnoceni.objects.all(): for h in Hodnoceni.objects.all():
if h.cislo_body.rocnik.rocnik < 26: if h.cislo_body is not None and h.cislo_body.rocnik.rocnik < 26:
# Deadline připravený v minulé migraci # Deadline připravený v minulé migraci
h.deadline_body = h.cislo_body.deadline_v_cisle.get() h.deadline_body = h.cislo_body.deadline_v_cisle.get()
h.save() h.save()

Loading…
Cancel
Save