Skip to content

Commit

Permalink
added a reserved name list and passing to profile and project model
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibhas committed Mar 25, 2019
1 parent 9b91865 commit 9f840d7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions funnel/models/helper.py
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 2 additions & 0 deletions funnel/models/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions funnel/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 9f840d7

Please sign in to comment.