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
12de0433
Commit
12de0433
authored
Oct 16, 2018
by
PJ Janse van Rensburg
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into nested-categories
parents
e73f6acc
108cbd75
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
3 deletions
+14
-3
changelog.rst
doc/changelog.rst
+1
-0
view.py
flask_admin/contrib/peewee/view.py
+6
-0
base.py
flask_admin/model/base.py
+6
-2
row_actions.html
...k_admin/templates/bootstrap3/admin/model/row_actions.html
+1
-1
No files found.
doc/changelog.rst
View file @
12de0433
...
...
@@ -8,6 +8,7 @@ next release
* Upgrade Leaflet and Leaflet.draw plugins, used for geoalchemy integration
* Specify `minimum_input_length` for ajax widget
* SQLAlchemy fix that lets you use inline model forms where models have multiple primary keys
* Peewee: support composite keys
* MongoEngine: when searching/filtering the input is now regarded as case-insensitive by default
1.5.2
...
...
flask_admin/contrib/peewee/view.py
View file @
12de0433
...
...
@@ -184,6 +184,10 @@ class ModelView(BaseModelView):
return
get_primary_key
(
self
.
model
)
def
get_pk_value
(
self
,
model
):
if
self
.
model
.
_meta
.
composite_key
:
return
tuple
([
model
.
_data
[
field_name
]
for
field_name
in
self
.
model
.
_meta
.
primary_key
.
field_names
])
return
getattr
(
model
,
self
.
_primary_key
)
def
scaffold_list_columns
(
self
):
...
...
@@ -440,6 +444,8 @@ class ModelView(BaseModelView):
return
count
,
query
def
get_one
(
self
,
id
):
if
self
.
model
.
_meta
.
composite_key
:
return
self
.
model
.
get
(
**
dict
(
zip
(
self
.
model
.
_meta
.
primary_key
.
field_names
,
id
)))
return
self
.
model
.
get
(
**
{
self
.
_primary_key
:
id
})
def
create_model
(
self
,
form
):
...
...
flask_admin/model/base.py
View file @
12de0433
...
...
@@ -18,7 +18,7 @@ from wtforms.fields import HiddenField
from
wtforms.fields.core
import
UnboundField
from
wtforms.validators
import
ValidationError
,
InputRequired
from
flask_admin.babel
import
gettext
from
flask_admin.babel
import
gettext
,
ngettext
from
flask_admin.base
import
BaseView
,
expose
from
flask_admin.form
import
BaseForm
,
FormOpts
,
rules
...
...
@@ -2204,7 +2204,11 @@ class BaseModelView(BaseView, ActionsMixin):
# message is flashed from within delete_model if it fails
if
self
.
delete_model
(
model
):
flash
(
gettext
(
'Record was successfully deleted.'
),
'success'
)
count
=
1
flash
(
ngettext
(
'Record was successfully deleted.'
,
'
%(count)
s records were successfully deleted.'
,
count
,
count
=
count
),
'success'
)
return
redirect
(
return_url
)
else
:
flash_errors
(
form
,
message
=
'Failed to delete record.
%(error)
s'
)
...
...
flask_admin/templates/bootstrap3/admin/model/row_actions.html
View file @
12de0433
...
...
@@ -31,7 +31,7 @@
{% elif csrf_token %}
<input
type=
"hidden"
name=
"csrf_token"
value=
"{{ csrf_token() }}"
/>
{% endif %}
<button
onclick=
"return safeConfirm('{{ _gettext('Are you sure you want to delete this record?') }}');"
title=
"
Delete record
"
>
<button
onclick=
"return safeConfirm('{{ _gettext('Are you sure you want to delete this record?') }}');"
title=
"
{{ _gettext('Delete record') }}
"
>
<span
class=
"fa fa-trash glyphicon glyphicon-trash"
></span>
</button>
</form>
...
...
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