|
|
@ -4,6 +4,8 @@ from __future__ import unicode_literals |
|
|
|
|
|
|
|
from django.db import migrations |
|
|
|
|
|
|
|
from datetime import date |
|
|
|
|
|
|
|
import logging |
|
|
|
|
|
|
|
logger = logging.getLogger(__name__) |
|
|
@ -23,6 +25,8 @@ def spoj_k_organizatorum_osoby(apps, scema_editor): |
|
|
|
# Je to podezřelé, ale prostě vyrobíme novou osobu. |
|
|
|
osoba = Osoba(user=user) |
|
|
|
# Téhle osobě nejdou nastavit detaily, protože žádné nemáme. |
|
|
|
# Datum registrace budiž minimální |
|
|
|
osoba.datum_registrace = date.min |
|
|
|
else: |
|
|
|
logger.info(f'Org {org.user.email}(ID: {org.id}) má uživatele {user}') |
|
|
|
# 💢💢💢 Python nemá goto, ale prý má výjimky… 💢💢💢 |
|
|
@ -55,6 +59,7 @@ def spoj_k_organizatorum_osoby(apps, scema_editor): |
|
|
|
osoba.email = user.email |
|
|
|
user.jmeno += " (Uživatel!)" |
|
|
|
user.prijmeni += " (Uživatel!)" |
|
|
|
osoba.datum_registrace = min(osoba.datum_registrace, user.date_joined, key=lambda d: d if d is not None else date.max) |
|
|
|
user.save() |
|
|
|
|
|
|
|
except EndException: pass |
|
|
|