Revision 674f9a52 snf-astakos-app/astakos/im/models.py
b/snf-astakos-app/astakos/im/models.py | ||
---|---|---|
63 | 63 |
from astakos.im.tasks import propagate_groupmembers_quota |
64 | 64 |
from astakos.im.functions import send_invitation |
65 | 65 |
|
66 |
import astakos.im.messages as astakos_messages |
|
67 |
|
|
66 | 68 |
logger = logging.getLogger(__name__) |
67 | 69 |
|
68 | 70 |
DEFAULT_CONTENT_TYPE = None |
... | ... | |
340 | 342 |
|
341 | 343 |
astakos_groups = models.ManyToManyField( |
342 | 344 |
AstakosGroup, verbose_name=_('agroups'), blank=True, |
343 |
help_text=_("""In addition to the permissions manually assigned, this |
|
344 |
user will also get all permissions granted to each group |
|
345 |
he/she is in."""), |
|
345 |
help_text=_(astakos_messages.ASTAKOSUSER_GROUPS_HELP), |
|
346 | 346 |
through='Membership') |
347 | 347 |
|
348 | 348 |
__has_signed_terms = False |
... | ... | |
519 | 519 |
q = q.filter(email=self.email) |
520 | 520 |
q = q.filter(is_active=self.is_active) |
521 | 521 |
if q.count() != 0: |
522 |
raise ValidationError({'__all__': [_('Another account with the same email & is_active combination found.')]})
|
|
522 |
raise ValidationError({'__all__': [_(astakos_messages.UNIQUE_EMAIL_IS_ACTIVE_CONSTRAIN_ERR)]})
|
|
523 | 523 |
|
524 | 524 |
@property |
525 | 525 |
def signed_terms(self): |
... | ... | |
690 | 690 |
except AstakosUser.DoesNotExist: |
691 | 691 |
pass |
692 | 692 |
else: |
693 |
raise ValueError(_('The new email address is reserved.'))
|
|
693 |
raise ValueError(_(astakos_messages.NEW_EMAIL_ADDR_RESERVED))
|
|
694 | 694 |
# update user |
695 | 695 |
user = AstakosUser.objects.get(pk=email_change.user_id) |
696 | 696 |
user.email = email_change.new_email_address |
... | ... | |
698 | 698 |
email_change.delete() |
699 | 699 |
return user |
700 | 700 |
except EmailChange.DoesNotExist: |
701 |
raise ValueError(_('Invalid activation key'))
|
|
701 |
raise ValueError(_(astakos_messages.INVALID_ACTIVATION_KEY))
|
|
702 | 702 |
|
703 | 703 |
|
704 | 704 |
class EmailChange(models.Model): |
705 | 705 |
new_email_address = models.EmailField(_(u'new e-mail address'), |
706 |
help_text=_(u'Your old email address will be used until you verify your new one.'))
|
|
706 |
help_text=_(astakos_messages.EMAIL_CHANGE_NEW_ADDR_HELP))
|
|
707 | 707 |
user = models.ForeignKey( |
708 | 708 |
AstakosUser, unique=True, related_name='emailchange_user') |
709 | 709 |
requested_at = models.DateTimeField(default=datetime.now()) |
... | ... | |
851 | 851 |
post_save.connect(send_quota_disturbed, sender=AstakosUserQuota) |
852 | 852 |
post_delete.connect(send_quota_disturbed, sender=AstakosUserQuota) |
853 | 853 |
post_save.connect(send_quota_disturbed, sender=AstakosGroupQuota) |
854 |
post_delete.connect(send_quota_disturbed, sender=AstakosGroupQuota) |
|
854 |
post_delete.connect(send_quota_disturbed, sender=AstakosGroupQuota) |
Also available in: Unified diff