Jmeno, prijmeni a email do osoby, ne do usera.
This commit is contained in:
parent
31fe029a98
commit
2b8241e9ea
2 changed files with 39 additions and 0 deletions
|
@ -23,6 +23,35 @@ def resitel_to_osoba(apps,schema_editor):
|
|||
o.telefon = r.telefon
|
||||
o.ulice = r.ulice
|
||||
o.user = r.user
|
||||
if o.user:
|
||||
u = o.user
|
||||
if u.first_name:
|
||||
if not o.jmeno:
|
||||
o.jmeno = u.first_name
|
||||
u.first_name = 'Použij osobu!'
|
||||
elif o.jmeno == u.first_name:
|
||||
u.first_name = 'Použij osobu!'
|
||||
else:
|
||||
raise ValueError('jmeno a first_name rozdílné: "{}" vs. "{}"'.format(o.jmeno, u.first_name))
|
||||
if u.last_name:
|
||||
if not o.prijmeni:
|
||||
o.prijmeni = u.last_name
|
||||
u.last_name = 'Použij osobu!'
|
||||
elif o.prijmeni == u.last_name:
|
||||
u.last_name = 'Použij osobu!'
|
||||
else:
|
||||
raise ValueError('prijmeni a last_name rozdílné: "{}" vs. "{}"'.format(o.prijmeni, u.last_name))
|
||||
if u.email:
|
||||
if not o.email:
|
||||
o.email = u.email
|
||||
u.email = 'Použij osobu!'
|
||||
elif o.email == u.email:
|
||||
u.email = 'Použij osobu!'
|
||||
else:
|
||||
raise ValueError('o.email a u.email rozdílné: "{}" vs. "{}"'.format(o.email, u.first_name))
|
||||
u.save()
|
||||
|
||||
|
||||
o.save()
|
||||
r.osoba = o
|
||||
r.save()
|
||||
|
|
|
@ -18,6 +18,16 @@ def spoj_k_organizatorum_osoby(apps, scema_editor):
|
|||
else:
|
||||
osoba = Osoba(user=user)
|
||||
|
||||
# Přesun informací z usera do osoby
|
||||
# pro řešitele již v minule migraci
|
||||
osoba.jmeno = user.first_name
|
||||
osoba.prijmeni = user.last_name
|
||||
osoba.email = user.email
|
||||
user.jmeno = "Použij osobu!"
|
||||
user.prijmeni = "Použij osobu!"
|
||||
user.email = "Použij osobu!"
|
||||
user.save()
|
||||
|
||||
# Přesun informací z organizátora do jeho osoby
|
||||
osoba.prezdivka = org.prezdivka if org.prezdivka is not None else ''
|
||||
osoba.foto = org.foto
|
||||
|
|
Loading…
Reference in a new issue