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
0fca4043
Commit
0fca4043
authored
Jul 02, 2019
by
P.J. Janse van Rensburg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more tweaks sqla example app
parent
abff067d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
app.py
examples/sqla/app.py
+4
-0
requirements.txt
examples/sqla/requirements.txt
+1
-1
tree_list.html
examples/sqla/templates/tree_list.html
+14
-0
No files found.
examples/sqla/app.py
View file @
0fca4043
...
@@ -338,6 +338,7 @@ class PostAdmin(sqla.ModelView):
...
@@ -338,6 +338,7 @@ class PostAdmin(sqla.ModelView):
class
TreeView
(
sqla
.
ModelView
):
class
TreeView
(
sqla
.
ModelView
):
list_template
=
'tree_list.html'
column_auto_select_related
=
True
column_auto_select_related
=
True
column_list
=
[
column_list
=
[
'id'
,
'id'
,
...
@@ -347,6 +348,9 @@ class TreeView(sqla.ModelView):
...
@@ -347,6 +348,9 @@ class TreeView(sqla.ModelView):
form_excluded_columns
=
[
'children'
,
]
form_excluded_columns
=
[
'children'
,
]
column_filters
=
[
'id'
,
'name'
,
'parent'
,]
column_filters
=
[
'id'
,
'name'
,
'parent'
,]
# override the 'render' method to pass your own parameters to the template
def
render
(
self
,
template
,
**
kwargs
):
return
super
(
TreeView
,
self
)
.
render
(
template
,
foo
=
"bar"
,
**
kwargs
)
# Create admin
# Create admin
admin
=
admin
.
Admin
(
app
,
name
=
'Example: SQLAlchemy'
,
template_mode
=
'bootstrap3'
)
admin
=
admin
.
Admin
(
app
,
name
=
'Example: SQLAlchemy'
,
template_mode
=
'bootstrap3'
)
...
...
examples/sqla/requirements.txt
View file @
0fca4043
Flask
Flask
-e /Users/petrus/code/flask-a
dmin
Flask-A
dmin
Flask-BabelEx
Flask-BabelEx
Flask-SQLAlchemy
Flask-SQLAlchemy
tablib
tablib
...
...
examples/sqla/templates/tree_list.html
0 → 100644
View file @
0fca4043
{% extends 'admin/model/list.html' %}
{% block body %}
<p>
This view demonstrated a tree structure, where there's a recursive relationship
between records on the same table.
<p>
<p>
It also demonstrates how to extend the builtin
<em>
list.html
</em>
template, and
pass your own parameters to the template. E.g. the parameter:
<em>
foo
</em>
, which
has the value
<b>
{{ foo }}
</b>
, passed in dynamically from the
<em>
{{ h.get_current_view().name }}
</em>
view.
</p>
{{ super() }}
{% 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