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
e87c4302
Commit
e87c4302
authored
Aug 26, 2015
by
Paul Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return user to previous list view after action
parent
45e2b81e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
actions.py
flask_admin/actions.py
+6
-4
actions.html
flask_admin/templates/bootstrap2/admin/actions.html
+1
-0
actions.html
flask_admin/templates/bootstrap3/admin/actions.html
+1
-0
No files found.
flask_admin/actions.py
View file @
e87c4302
...
@@ -3,6 +3,7 @@ from flask import request, redirect
...
@@ -3,6 +3,7 @@ from flask import request, redirect
from
flask_admin
import
tools
from
flask_admin
import
tools
from
flask_admin._compat
import
text_type
from
flask_admin._compat
import
text_type
from
flask_admin.helpers
import
get_redirect_target
def
action
(
name
,
text
,
confirmation
=
None
):
def
action
(
name
,
text
,
confirmation
=
None
):
...
@@ -100,7 +101,8 @@ class ActionsMixin(object):
...
@@ -100,7 +101,8 @@ class ActionsMixin(object):
:param return_view:
:param return_view:
Name of the view to return to after the request.
Name of the view to return to after the request.
If not provided, will return user to the index view.
If not provided, will return user to the return url in the form
or the list view.
"""
"""
action
=
request
.
form
.
get
(
'action'
)
action
=
request
.
form
.
get
(
'action'
)
ids
=
request
.
form
.
getlist
(
'rowid'
)
ids
=
request
.
form
.
getlist
(
'rowid'
)
...
@@ -113,9 +115,9 @@ class ActionsMixin(object):
...
@@ -113,9 +115,9 @@ class ActionsMixin(object):
if
response
is
not
None
:
if
response
is
not
None
:
return
response
return
response
if
not
return_view
:
if
return_view
:
url
=
self
.
get_url
(
'.'
+
self
.
_default_view
)
else
:
url
=
self
.
get_url
(
'.'
+
return_view
)
url
=
self
.
get_url
(
'.'
+
return_view
)
else
:
url
=
get_redirect_target
()
or
self
.
get_url
(
'.index_view'
)
return
redirect
(
url
)
return
redirect
(
url
)
flask_admin/templates/bootstrap2/admin/actions.html
View file @
e87c4302
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
{% if csrf_token %}
{% if csrf_token %}
<input
type=
"hidden"
name=
"csrf_token"
value=
"{{ csrf_token() }}"
/>
<input
type=
"hidden"
name=
"csrf_token"
value=
"{{ csrf_token() }}"
/>
{% endif %}
{% endif %}
<input
type=
"hidden"
name=
"url"
value=
"{{ return_url }}"
>
<input
type=
"hidden"
id=
"action"
name=
"action"
/>
<input
type=
"hidden"
id=
"action"
name=
"action"
/>
</form>
</form>
{% endif %}
{% endif %}
...
...
flask_admin/templates/bootstrap3/admin/actions.html
View file @
e87c4302
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
{% if csrf_token %}
{% if csrf_token %}
<input
type=
"hidden"
name=
"csrf_token"
value=
"{{ csrf_token() }}"
/>
<input
type=
"hidden"
name=
"csrf_token"
value=
"{{ csrf_token() }}"
/>
{% endif %}
{% endif %}
<input
type=
"hidden"
name=
"url"
value=
"{{ return_url }}"
>
<input
type=
"hidden"
id=
"action"
name=
"action"
/>
<input
type=
"hidden"
id=
"action"
name=
"action"
/>
</form>
</form>
{% endif %}
{% endif %}
...
...
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