Permalink
Browse files

delete now routes by default to /prefix/primary_key/delete

  • Loading branch information...
kvesteri committed Jan 11, 2013
1 parent 8399620 commit 315fd1c257a22a93bc5a7a88b369c26fcc90b8be
Showing with 8 additions and 4 deletions.
  1. +8 −4 flask_generic_views/__init__.py
@@ -275,7 +275,9 @@ def get_form(self, obj=None):
"""
if self.form_class:
return self.form_class(request.form, obj=obj)
- return model_form(self.model_class, db_session=self.db.session)(request.form, obj=obj)
+ return model_form(self.model_class, db_session=self.db.session)(
+ request.form, obj=obj
+ )
def get_success_redirect(self):
"""
@@ -648,7 +650,7 @@ def __init__(self, model_class, **kwargs):
'edit': ['%(prefix)s/%(primary_key)s/edit', UpdateFormView, {}],
'new': ['%(prefix)s/new', CreateFormView, {}],
'update': ['%(prefix)s/%(primary_key)s', UpdateView, {}],
- 'delete': ['%(prefix)s/%(primary_key)s', DeleteView, {}],
+ 'delete': ['%(prefix)s/%(primary_key)s/delete', DeleteView, {}],
'show': ['%(prefix)s/%(primary_key)s', ShowView, {}]
}
@@ -726,8 +728,10 @@ def bind_route(self, key, route):
def register(self, blueprint=None):
if not blueprint:
- blueprint = Blueprint(underscore(self.model_class.__name__),
- __name__)
+ blueprint = Blueprint(
+ underscore(self.model_class.__name__),
+ __name__
+ )
for key, value in self.get_routes().items():
route, view, kwargs = value

0 comments on commit 315fd1c

Please sign in to comment.