diff --git a/apps/user/models.py b/apps/user/models.py index 7c3bb6ae..ebbef261 100644 --- a/apps/user/models.py +++ b/apps/user/models.py @@ -85,13 +85,13 @@ class User(AbstractUser): def create_auth_token(sender, instance=None, created=False, **kwargs): if ( (instance.is_active or instance.fb_id) and - instance.role in [User.AUTHOR_ROLE, User.ADMIN_ROLE] and not + instance.role in [User.AUTHOR_ROLE, User.TEACHER_ROLE, User.ADMIN_ROLE] and not hasattr(instance, 'auth_token') ): Token.objects.create(user=instance) elif ( not (instance.is_active or instance.fb_id) or - instance.role not in [User.AUTHOR_ROLE, User.ADMIN_ROLE] + instance.role not in [User.AUTHOR_ROLE, User.TEACHER_ROLE, User.ADMIN_ROLE] ) and hasattr(instance, 'auth_token'): instance.auth_token.delete()