diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-05-28 17:55:40 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 08:49:36 +0200 | 
| commit | 7efb66709a5d1d4f2bae89e0a98f7390d17b8eb4 (patch) | |
| tree | 9a685b60c30550e2e383e574caf4fd448c13d3ea /ishtar_common/models.py | |
| parent | 1dc2eb2ebc5a837d745358620f1dfd35544632ac (diff) | |
| download | Ishtar-7efb66709a5d1d4f2bae89e0a98f7390d17b8eb4.tar.bz2 Ishtar-7efb66709a5d1d4f2bae89e0a98f7390d17b8eb4.zip | |
Test: user profile form
Diffstat (limited to 'ishtar_common/models.py')
| -rw-r--r-- | ishtar_common/models.py | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/ishtar_common/models.py b/ishtar_common/models.py index b31338a2d..f3fda4e60 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2830,8 +2830,16 @@ class UserProfile(models.Model):          areas = [area for area in self.areas.all()]          new_item = self          new_item.pk = None +        name = self.name          for key in kwargs: +            if key == 'name': +                name = kwargs[key]              setattr(new_item, key, kwargs[key]) +        while UserProfile.objects.filter( +                name=name, profile_type=self.profile_type, +                person=self.person).count(): +            name += unicode(_(u" - duplicate")) +        new_item.name = name          new_item.save()          for area in areas:              new_item.areas.add(area) | 
