diff --git a/funnel/models/helper.py b/funnel/models/helper.py new file mode 100644 index 000000000..f459d122e --- /dev/null +++ b/funnel/models/helper.py @@ -0,0 +1,7 @@ +reserved_words = [ + 'api', 'proposal', 'video', 'workshop', 'project', 'new', 'blog', 'post', + 'hacknight', 'event', 'brand', 'edit', 'admin', 'section', 'venue', 'ticket', + 'kharcha', 'funnel', 'hgtv', 'hasjob', 'boxoffice', 'app' +] + +RESERVED_NAMES = reserved_words + [w + 's' for w in reserved_words] diff --git a/funnel/models/profile.py b/funnel/models/profile.py index a91fee550..9dcd93d97 100644 --- a/funnel/models/profile.py +++ b/funnel/models/profile.py @@ -4,12 +4,14 @@ from . import MarkdownColumn, UuidMixin, UrlType, db from .user import UseridMixin, Team +from .helper import RESERVED_NAMES __all__ = ['Profile'] class Profile(UseridMixin, UuidMixin, ProfileBase, db.Model): __tablename__ = 'profile' + reserved_names = RESERVED_NAMES admin_team_id = db.Column(None, db.ForeignKey('team.id'), nullable=True) admin_team = db.relationship(Team) diff --git a/funnel/models/project.py b/funnel/models/project.py index 4f8662923..d569b66b9 100644 --- a/funnel/models/project.py +++ b/funnel/models/project.py @@ -17,6 +17,7 @@ from .user import Team, User from .profile import Profile from .commentvote import Commentset, SET_TYPE, Voteset +from .helper import RESERVED_NAMES __all__ = ['Project', 'ProjectRedirect', 'ProjectLocation'] @@ -49,6 +50,7 @@ class SCHEDULE_STATE(LabeledEnum): class Project(UuidMixin, BaseScopedNameMixin, db.Model): __tablename__ = 'project' + reserved_names = RESERVED_NAMES user_id = db.Column(None, db.ForeignKey('user.id'), nullable=False) user = db.relationship(