summaryrefslogtreecommitdiff
path: root/ishtar_common/wizards.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2018-05-28 16:58:42 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2018-06-12 08:49:36 +0200
commit1dc2eb2ebc5a837d745358620f1dfd35544632ac (patch)
treec616f2686db785b7b1103beb85636d1891cc354c /ishtar_common/wizards.py
parenteba5908a065ba3461fdc1337f617c1af7f2abc60 (diff)
downloadIshtar-1dc2eb2ebc5a837d745358620f1dfd35544632ac.tar.bz2
Ishtar-1dc2eb2ebc5a837d745358620f1dfd35544632ac.zip
User profile form: duplicate, delete and edit
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r--ishtar_common/wizards.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py
index a6d0befd5..3e153c9dd 100644
--- a/ishtar_common/wizards.py
+++ b/ishtar_common/wizards.py
@@ -1619,7 +1619,6 @@ class AccountWizard(Wizard):
model = models.Person
formset_pop_deleted = False
wizard_done_window = reverse_lazy('show-person')
- modification = True
def get_formated_datas(self, forms):
datas = super(AccountWizard, self).get_formated_datas(forms)
@@ -1695,6 +1694,8 @@ class AccountWizard(Wizard):
profile.delete()
continue
+ name = data.get('name', None)
+
profile_type_id = data.get('profile_type', None)
if not profile_type_id:
continue
@@ -1704,13 +1705,17 @@ class AccountWizard(Wizard):
)
except models.ProfileType.DoesNotExist:
continue
+
+ if not name:
+ name = profile_type.label
+
if profile:
- if profile_type != profile.profile_type:
- profile.profile_type = profile_type
- profile.save()
+ profile.name = name
+ profile.profile_type = profile_type
+ profile.save()
else:
profile = models.UserProfile.objects.create(
- profile_type=profile_type, person=person)
+ profile_type=profile_type, person=person, name=name)
area_pks = data.get('area', None)
areas = []
if area_pks: