def validate_python(self, value, state): # If there are users in selected locations and this user are not current # user, we will show some Error. for user in User.get_all(c.user.username): if user.location == value and user.id != c.user.id: raise Invalid(self.message('duplicated', state), value, state)