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
506b0fe3
Commit
506b0fe3
authored
Nov 06, 2013
by
Petrus J.v.Rensburg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make 'layout' example deployable.
parent
1dde7e1c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
__init__.py
examples/layout/__init__.py
+0
-0
sample_db.sqlite
examples/layout/sample_db.sqlite
+0
-0
simple.py
examples/layout/simple.py
+8
-7
No files found.
examples/layout/__init__.py
0 → 100644
View file @
506b0fe3
examples/layout/sample_db.sqlite
0 → 100644
View file @
506b0fe3
File added
examples/layout/simple.py
View file @
506b0fe3
...
@@ -11,7 +11,7 @@ app = Flask(__name__)
...
@@ -11,7 +11,7 @@ app = Flask(__name__)
app
.
config
[
'SECRET_KEY'
]
=
'123456790'
app
.
config
[
'SECRET_KEY'
]
=
'123456790'
# Create in-memory database
# Create in-memory database
app
.
config
[
'SQLALCHEMY_DATABASE_URI'
]
=
'sqlite:///
dummy
.sqlite'
app
.
config
[
'SQLALCHEMY_DATABASE_URI'
]
=
'sqlite:///
sample_db
.sqlite'
app
.
config
[
'SQLALCHEMY_ECHO'
]
=
True
app
.
config
[
'SQLALCHEMY_ECHO'
]
=
True
db
=
SQLAlchemy
(
app
)
db
=
SQLAlchemy
(
app
)
...
@@ -53,13 +53,14 @@ def index():
...
@@ -53,13 +53,14 @@ def index():
return
'<a href="/admin/">Click me to get to Admin!</a>'
return
'<a href="/admin/">Click me to get to Admin!</a>'
if
__name__
==
'__main__'
:
# Create admin with custom base template
# Create admin with custom base template
admin
=
admin
.
Admin
(
app
,
base_template
=
'layout.html'
)
admin
=
admin
.
Admin
(
app
,
base_template
=
'layout.html'
)
# Add views
admin
.
add_view
(
UserAdmin
(
User
,
db
.
session
))
admin
.
add_view
(
CustomView
(
Page
,
db
.
session
))
# Add views
if
__name__
==
'__main__'
:
admin
.
add_view
(
UserAdmin
(
User
,
db
.
session
))
admin
.
add_view
(
CustomView
(
Page
,
db
.
session
))
# Create DB
# Create DB
db
.
create_all
()
db
.
create_all
()
...
...
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