app/soc/views/user/profile.py
changeset 483 70f21691b0e1
parent 482 839740b061ad
child 496 875bdc5741eb
equal deleted inserted replaced
482:839740b061ad 483:70f21691b0e1
    60     if not validate.isLinkNameFormatValid(link_name):
    60     if not validate.isLinkNameFormatValid(link_name):
    61       raise forms.ValidationError("This link name is in wrong format.")
    61       raise forms.ValidationError("This link name is in wrong format.")
    62 
    62 
    63     user = models.user.logic.getForFields({'link_name': link_name},
    63     user = models.user.logic.getForFields({'link_name': link_name},
    64                                           unique=True)
    64                                           unique=True)
       
    65     
       
    66     # Get the currently logged in user account
       
    67     current_account = users.get_current_user()
       
    68     
    65     if user:
    69     if user:
    66       raise forms.ValidationError("This link name is already in use.")
    70       if current_account != user.account:
       
    71         raise forms.ValidationError("This link name is already in use.")
    67 
    72 
    68     return link_name
    73     return link_name
    69 
    74 
    70 
    75 
    71 DEF_USER_PROFILE_EDIT_TMPL = 'soc/user/edit_self.html'
    76 DEF_USER_PROFILE_EDIT_TMPL = 'soc/user/edit_self.html'