Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
d72dd6bb
Commit
d72dd6bb
authored
Dec 18, 2012
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #118, handy decorator for class views
parent
7fb2d6bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
5 deletions
+16
-5
__init__.py
flask_admin/__init__.py
+1
-1
base.py
flask_admin/base.py
+14
-3
__init__.py
flask_admin/contrib/__init__.py
+1
-1
No files found.
flask_admin/__init__.py
View file @
d72dd6bb
...
@@ -3,4 +3,4 @@ __author__ = 'Serge S. Koval'
...
@@ -3,4 +3,4 @@ __author__ = 'Serge S. Koval'
__email__
=
'serge.koval+github@gmail.com'
__email__
=
'serge.koval+github@gmail.com'
from
.base
import
expose
,
Admin
,
BaseView
,
AdminIndexView
from
.base
import
expose
,
expose_class
,
Admin
,
BaseView
,
AdminIndexView
flask_admin/base.py
View file @
d72dd6bb
import
sys
import
os.path
from
functools
import
wraps
from
functools
import
wraps
from
re
import
sub
from
re
import
sub
...
@@ -29,6 +26,20 @@ def expose(url='/', methods=('GET',)):
...
@@ -29,6 +26,20 @@ def expose(url='/', methods=('GET',)):
return
wrap
return
wrap
def
expose_class
(
url
=
'/'
):
"""
User this decorator to expose ``View`` classes (flask.MethodView).
:param url:
Relative URL for the view
"""
def
wrap
(
v
):
name
=
v
.
__name__
print
name
return
expose
(
url
)(
v
.
as_view
(
name
))
return
wrap
# Base views
# Base views
def
_wrap_view
(
f
):
def
_wrap_view
(
f
):
@
wraps
(
f
)
@
wraps
(
f
)
...
...
flask_admin/contrib/__init__.py
View file @
d72dd6bb
__import__
(
'pkg_resources'
)
.
declare_namespace
(
__name__
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment