diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-04-09 19:06:10 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-06-12 08:39:42 +0200 | 
| commit | eada3318b5244c9556314f1f68012260e7b95d22 (patch) | |
| tree | d580da3cf240f3d1b8e2be5fd1ad6b93a997133d /ishtar_common/models.py | |
| parent | de232cf70cd7edbc998c2902b84c56bdf5645130 (diff) | |
| download | Ishtar-eada3318b5244c9556314f1f68012260e7b95d22.tar.bz2 Ishtar-eada3318b5244c9556314f1f68012260e7b95d22.zip | |
Profile: default->current
Diffstat (limited to 'ishtar_common/models.py')
| -rw-r--r-- | ishtar_common/models.py | 13 | 
1 files changed, 5 insertions, 8 deletions
| diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 7c2069309..9aaf7bab1 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2471,20 +2471,17 @@ class Person(Address, Merge, OwnPerms, ValueGetter):               for attr in ['title', 'salutation'] if getattr(self, attr)])      @property -    def default_profile(self): -        q = self.profiles.filter(default=True) +    def current_profile(self): +        q = self.profiles.filter(current=True)          if q.count():              return q.all()[0]          q = self.profiles          nb = q.count()          if not nb:              return -        if nb > 1: -            # arbitrary return the first one -            return q.all()[0] -        # if there is only one it is the default +        # arbitrary set the first one as the current          profile = q.all()[0] -        profile.default = True +        profile.current = True          profile.save()          return profile @@ -2665,7 +2662,7 @@ post_delete.connect(post_save_cache, sender=ProfileType)  class UserProfile(models.Model):      profile_type = models.ForeignKey(          ProfileType, verbose_name=_(u"Profile type")) -    default = models.BooleanField(_(u"Default profile"), default=False) +    current = models.BooleanField(_(u"Current profile"), default=False)      person = models.ForeignKey(          Person, verbose_name=_(u"Person"), related_name='profiles') | 
