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
31f6c86c
Commit
31f6c86c
authored
Jul 24, 2013
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #262. Save and continue button for edit views
parent
d466862a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
base.py
flask_admin/model/base.py
+7
-1
edit.html
flask_admin/templates/admin/model/edit.html
+5
-1
No files found.
flask_admin/model/base.py
View file @
31f6c86c
...
...
@@ -1090,7 +1090,13 @@ class BaseModelView(BaseView, ActionsMixin):
if
validate_form_on_submit
(
form
):
if
self
.
update_model
(
form
,
model
):
return
redirect
(
return_url
)
if
'_continue_editing'
in
request
.
form
:
flash
(
gettext
(
'Model was successfully saved.'
))
# Recreate form
form
=
self
.
edit_form
(
obj
=
model
)
else
:
return
redirect
(
return_url
)
return
self
.
render
(
self
.
edit_template
,
model
=
model
,
...
...
flask_admin/templates/admin/model/edit.html
View file @
31f6c86c
{% extends 'admin/master.html' %}
{% import 'admin/lib.html' as lib with context %}
{% macro extra() %}
<input
name=
"_continue_editing"
type=
"submit"
class=
"btn btn-large"
value=
"{{ _gettext('Save and Continue') }}"
/>
{% endmacro %}
{% block head %}
{{ super() }}
<link
href=
"{{ url_for('admin.static', filename='select2/select2.css') }}"
rel=
"stylesheet"
>
...
...
@@ -10,7 +14,7 @@
{% block body %}
{% call lib.form_tag(form) %}
{{ lib.render_form_fields(form, widget_args=form_widget_args) }}
{{ lib.render_form_buttons(return_url) }}
{{ lib.render_form_buttons(return_url
, extra()
) }}
{% endcall %}
{% 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