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
12411641
Commit
12411641
authored
Sep 10, 2012
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added sample
parent
b1702039
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
0 deletions
+48
-0
multi.py
examples/multi/multi.py
+40
-0
first.html
examples/multi/templates/first.html
+4
-0
second.html
examples/multi/templates/second.html
+4
-0
No files found.
examples/multi/multi.py
0 → 100644
View file @
12411641
from
flask
import
Flask
from
flask.ext
import
admin
# Views
class
FirstView
(
admin
.
BaseView
):
@
admin
.
expose
(
'/'
)
def
index
(
self
):
return
self
.
render
(
'first.html'
)
class
SecondView
(
admin
.
BaseView
):
@
admin
.
expose
(
'/'
)
def
index
(
self
):
return
self
.
render
(
'second.html'
)
# Create flask app
app
=
Flask
(
__name__
,
template_folder
=
'templates'
)
# Flask views
@
app
.
route
(
'/'
)
def
index
():
return
'<a href="/admin1">Click me to get to Admin 1</a><br/><a href="/admin2">Click me to get to Admin 2</a>'
if
__name__
==
'__main__'
:
# Create first administrative interface under /admin1
admin1
=
admin
.
Admin
(
app
,
url
=
'/admin1'
)
admin1
.
add_view
(
FirstView
())
# Create second administrative interface under /admin2
admin2
=
admin
.
Admin
(
app
,
url
=
'/admin2'
,
endpoint
=
'admin2'
)
admin2
.
add_view
(
SecondView
())
# Start app
app
.
debug
=
True
app
.
run
()
examples/multi/templates/first.html
0 → 100644
View file @
12411641
{% extends 'admin/master.html' %}
{% block body %}
First admin view.
{% endblock %}
examples/multi/templates/second.html
0 → 100644
View file @
12411641
{% extends 'admin/master.html' %}
{% block body %}
Second admin view.
{% endblock %}
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