diff --git a/june/forms/account.py b/june/forms/account.py index 3a6b106..49c70c2 100644 --- a/june/forms/account.py +++ b/june/forms/account.py @@ -21,7 +21,7 @@ RESERVED_WORDS = [ 'root', 'admin', 'bot', 'robot', 'master', 'webmaster', 'account', 'people', 'user', 'users', 'project', 'projects', - 'search', 'action', 'favorite', 'like', 'love', + 'search', 'action', 'favorite', 'like', 'love', 'none', 'team', 'teams', 'group', 'groups', 'organization', 'organizations', 'package', 'packages', 'org', 'com', 'net', 'help', 'doc', 'docs', 'document', 'documentation', 'blog', diff --git a/june/models/account.py b/june/models/account.py index b795d42..32e58b7 100644 --- a/june/models/account.py +++ b/june/models/account.py @@ -5,7 +5,7 @@ from werkzeug import security from ._base import db, JuneQuery, SessionMixin -__all__ = ['Account'] +__all__ = ['Account', 'NonAccount'] class Account(db.Model, SessionMixin): @@ -84,3 +84,19 @@ def change_password(self, raw): self.password = self.create_password(raw) self.token = self.create_token() return self + + +class NonAccount(object): + """Non Account is a model designed for the deleted account. + Since the account is deleted, the topics and replies will has no + account related to them, in such cases, a `NonAccount` is used.""" + + username = 'none' + is_staff = False + is_admin = False + + def __str__(self): + return 'none' + + def __repr__(self): + return '' % self.username