diff options
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 |
commit | f5634457ef7882cbc9fcb30d0e12a61d4f13498a (patch) | |
tree | c616f2686db785b7b1103beb85636d1891cc354c /ishtar_common/wizards.py | |
parent | 4fba7337a52de2efd795b24cb9cd2797b1427987 (diff) | |
download | Ishtar-f5634457ef7882cbc9fcb30d0e12a61d4f13498a.tar.bz2 Ishtar-f5634457ef7882cbc9fcb30d0e12a61d4f13498a.zip |
User profile form: duplicate, delete and edit
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r-- | ishtar_common/wizards.py | 15 |
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: |