Skip to content

Instantly share code, notes, and snippets.

@horiajurcut
Created July 2, 2014 14:26
Show Gist options
  • Save horiajurcut/4bbea1c1fb638ea23d01 to your computer and use it in GitHub Desktop.
Save horiajurcut/4bbea1c1fb638ea23d01 to your computer and use it in GitHub Desktop.
from flask.ext.classy import route
class ModelView(BaseView):
@route('/<int:entity_id>')
@route('/<int:entity_id>/<string:relationship>')
def get(self, entity_id, relationship=None):
# Available routes will be:
# http://domain.com/<prefix>/<model_view_subclass>/<id>
# http://domain.com/<prefix>/<model_view_subclass>/<id>/<relationship>
# model_view_subclass: if class is BookmarksView => model_view_subclass = 'bookmarks'
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment