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
73256448
Commit
73256448
authored
Aug 19, 2012
by
mrjoes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up code a bit
parent
b6541d53
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
106 deletions
+105
-106
admin.pot
babel/admin.pot
+81
-57
view.py
flask_admin/contrib/sqlamodel/view.py
+4
-2
base.py
flask_admin/model/base.py
+11
-6
list.html
flask_admin/templates/admin/model/list.html
+9
-41
No files found.
babel/admin.pot
View file @
73256448
# Translations template for Flask-Admin
Ex
.
# Translations template for Flask-Admin.
# Copyright (C) 2012 ORGANIZATION
# This file is distributed under the same license as the Flask-Admin
Ex
# This file is distributed under the same license as the Flask-Admin
# project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Flask-Admin
Ex
VERSION\n"
"Project-Id-Version: Flask-Admin VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2012-0
4-11 18:47
+0300\n"
"POT-Creation-Date: 2012-0
8-19 10:04
+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
...
@@ -18,224 +18,248 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.6\n"
#: ../flask_admin
ex/base.py:216
#: ../flask_admin
/base.py:217
msgid "Home"
msgstr ""
#: ../flask_admin
ex
/form.py:81
#: ../flask_admin/form.py:81
msgid "Invalid time format"
msgstr ""
#: ../flask_admin
ex/ext
/fileadmin.py:32
#: ../flask_admin
/contrib
/fileadmin.py:32
msgid "Invalid directory name"
msgstr ""
#: ../flask_admin
ex/ext
/fileadmin.py:40
#: ../flask_admin
/contrib
/fileadmin.py:40
msgid "File to upload"
msgstr ""
#: ../flask_admin
ex/ext
/fileadmin.py:49
#: ../flask_admin
/contrib
/fileadmin.py:49
msgid "File required."
msgstr ""
#: ../flask_admin
ex/ext
/fileadmin.py:54
#: ../flask_admin
/contrib
/fileadmin.py:54
msgid "Invalid file type."
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:335
#: ../flask_admin
/contrib/fileadmin.py:338
msgid "File uploading is disabled."
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:344
#: ../flask_admin
/contrib/fileadmin.py:347
#, python-format
msgid "File \"%(name)s\" already exists."
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:351
#: ../flask_admin
/contrib/fileadmin.py:354
#, python-format
msgid "Failed to save file: %(error)s"
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:370
#: ../flask_admin
/contrib/fileadmin.py:373
msgid "Directory creation is disabled."
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:380
#: ../flask_admin
/contrib/fileadmin.py:383
#, python-format
msgid "Failed to create directory: %(error)s"
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:402
#: ../flask_admin
/contrib/fileadmin.py:405
msgid "Deletion is disabled."
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:407
#: ../flask_admin
/contrib/fileadmin.py:410
msgid "Directory deletion is disabled."
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:412
#: ../flask_admin
/contrib/fileadmin.py:415
#, python-format
msgid "Directory \"%s\" was successfully deleted."
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:414
#: ../flask_admin
/contrib/fileadmin.py:417
#, python-format
msgid "Failed to delete directory: %(error)s"
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:418
#: ../flask_admin
/contrib/fileadmin.py:421
#, python-format
msgid "File \"%(name)s\" was successfully deleted."
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:420
#: ../flask_admin
/contrib/fileadmin.py:423
#, python-format
msgid "Failed to delete file: %(name)s"
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:439
#: ../flask_admin
/contrib/fileadmin.py:442
msgid "Renaming is disabled."
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:443
#: ../flask_admin
/contrib/fileadmin.py:446
msgid "Path does not exist."
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:454
#: ../flask_admin
/contrib/fileadmin.py:457
#, python-format
msgid "Successfully renamed \"%(src)s\" to \"%(dst)s\""
msgstr ""
#: ../flask_admin
ex/ext/fileadmin.py:457
#: ../flask_admin
/contrib/fileadmin.py:460
#, python-format
msgid "Failed to rename: %(error)s"
msgstr ""
#: ../flask_admin
ex/ext
/sqlamodel/filters.py:35
#: ../flask_admin
/contrib
/sqlamodel/filters.py:35
msgid "equals"
msgstr ""
#: ../flask_admin
ex/ext
/sqlamodel/filters.py:43
#: ../flask_admin
/contrib
/sqlamodel/filters.py:43
msgid "not equal"
msgstr ""
#: ../flask_admin
ex/ext
/sqlamodel/filters.py:52
#: ../flask_admin
/contrib
/sqlamodel/filters.py:52
msgid "contains"
msgstr ""
#: ../flask_admin
ex/ext
/sqlamodel/filters.py:61
#: ../flask_admin
/contrib
/sqlamodel/filters.py:61
msgid "not contains"
msgstr ""
#: ../flask_admin
ex/ext
/sqlamodel/filters.py:69
#: ../flask_admin
/contrib
/sqlamodel/filters.py:69
msgid "greater than"
msgstr ""
#: ../flask_admin
ex/ext
/sqlamodel/filters.py:77
#: ../flask_admin
/contrib
/sqlamodel/filters.py:77
msgid "smaller than"
msgstr ""
#: ../flask_admin
ex/ext
/sqlamodel/form.py:37
#: ../flask_admin
/contrib
/sqlamodel/form.py:37
msgid "Already exists."
msgstr ""
#: ../flask_admin
ex/ext/sqlamodel/view.py:504
#: ../flask_admin
/contrib/sqlamodel/view.py:520
#, python-format
msgid "Failed to create model. %(error)s"
msgstr ""
#: ../flask_admin
ex/ext/sqlamodel/view.py:519
#: ../flask_admin
/contrib/sqlamodel/view.py:535
#, python-format
msgid "Failed to update model. %(error)s"
msgstr ""
#: ../flask_admin
ex/ext/sqlamodel/view.py:534
#: ../flask_admin
/contrib/sqlamodel/view.py:550
#, python-format
msgid "Failed to delete model. %(error)s"
msgstr ""
#: ../flask_adminex/model/base.py:742
#: ../flask_admin/contrib/sqlamodel/view.py:561
msgid "delete"
msgstr ""
#: ../flask_admin/contrib/sqlamodel/view.py:573
#, python-format
msgid "Model was successfully deleted."
msgid_plural "%(count)s models were sucessfully deleted."
msgstr[0] ""
msgstr[1] ""
#: ../flask_admin/contrib/sqlamodel/view.py:578
#, python-format
msgid "Failed to delete models. %(error)s"
msgstr ""
#: ../flask_admin/model/base.py:784
msgid "Model was successfully created."
msgstr ""
#: ../flask_admin
ex
/model/filters.py:82
#: ../flask_admin/model/filters.py:82
msgid "Yes"
msgstr ""
#: ../flask_admin
ex
/model/filters.py:83
#: ../flask_admin/model/filters.py:83
msgid "No"
msgstr ""
#: ../flask_admin
ex/templates/admin/lib.html:105
#: ../flask_admin
/templates/admin/lib.html:108
msgid "Submit"
msgstr ""
#: ../flask_admin
ex/templates/admin/lib.html:110
#: ../flask_admin
/templates/admin/lib.html:113
msgid "Cancel"
msgstr ""
#: ../flask_admin
ex
/templates/admin/file/list.html:7
#: ../flask_admin/templates/admin/file/list.html:7
msgid "Root"
msgstr ""
#: ../flask_admin
ex
/templates/admin/file/list.html:42
#: ../flask_admin/templates/admin/file/list.html:42
#, python-format
msgid "Are you sure you want to delete \\'%(name)s\\' recursively?"
msgstr ""
#: ../flask_admin
ex
/templates/admin/file/list.html:50
#: ../flask_admin/templates/admin/file/list.html:50
#, python-format
msgid "Are you sure you want to delete \\'%(name)s\\'?"
msgstr ""
#: ../flask_admin
ex
/templates/admin/file/list.html:75
#: ../flask_admin/templates/admin/file/list.html:75
msgid "Upload File"
msgstr ""
#: ../flask_admin
ex
/templates/admin/file/list.html:78
#: ../flask_admin/templates/admin/file/list.html:78
msgid "Create Directory"
msgstr ""
#: ../flask_admin
ex
/templates/admin/file/rename.html:5
#: ../flask_admin/templates/admin/file/rename.html:5
#, python-format
msgid "Please provide new name for %(name)s"
msgstr ""
#: ../flask_admin
ex
/templates/admin/model/create.html:11
#: ../flask_admin/templates/admin/model/create.html:11
msgid "Save and Add"
msgstr ""
#: ../flask_admin
ex
/templates/admin/model/create.html:16
#: ../flask_admin
ex
/templates/admin/model/list.html:12
#: ../flask_admin/templates/admin/model/create.html:16
#: ../flask_admin/templates/admin/model/list.html:12
msgid "List"
msgstr ""
#: ../flask_admin
ex
/templates/admin/model/create.html:19
#: ../flask_admin
ex
/templates/admin/model/list.html:16
#: ../flask_admin/templates/admin/model/create.html:19
#: ../flask_admin/templates/admin/model/list.html:16
msgid "Create"
msgstr ""
#: ../flask_admin
ex
/templates/admin/model/list.html:23
#: ../flask_admin/templates/admin/model/list.html:23
msgid "Add Filter"
msgstr ""
#: ../flask_adminex/templates/admin/model/list.html:44
#: ../flask_admin/templates/admin/model/list.html:38
msgid "With selected"
msgstr ""
#: ../flask_admin/templates/admin/model/list.html:59
msgid "Search"
msgstr ""
#: ../flask_admin
ex/templates/admin/model/list.html:57
#: ../flask_admin
/templates/admin/model/list.html:72
msgid "Apply"
msgstr ""
#: ../flask_admin
ex/templates/admin/model/list.html:59
#: ../flask_admin
/templates/admin/model/list.html:74
msgid "Reset Filters"
msgstr ""
#: ../flask_admin
ex/templates/admin/model/list.html:67
#: ../flask_admin
/templates/admin/model/list.html:82
msgid "Remove Filter"
msgstr ""
#: ../flask_admin
ex/templates/admin/model/list.html:128
#: ../flask_admin
/templates/admin/model/list.html:153
msgid "You sure you want to delete this item?"
msgstr ""
#: ../flask_admin/templates/admin/model/list.html:211
msgid "Please select at least one model."
msgstr ""
flask_admin/contrib/sqlamodel/view.py
View file @
73256448
...
...
@@ -6,7 +6,7 @@ from wtforms.ext.sqlalchemy.orm import model_form
from
flask
import
flash
from
flask.ext.admin.babel
import
gettext
,
ngettext
from
flask.ext.admin.babel
import
gettext
,
ngettext
,
lazy_gettext
from
flask.ext.admin.form
import
BaseForm
from
flask.ext.admin.model
import
BaseModelView
,
action
...
...
@@ -558,7 +558,9 @@ class ModelView(BaseModelView):
return
super
(
ModelView
,
self
)
.
is_action_allowed
(
name
)
@
action
(
'delete'
,
'Delete'
,
'Are you sure you want to delete selected models?'
)
@
action
(
'delete'
,
lazy_gettext
(
'Delete'
),
lazy_gettext
(
'Are you sure you want to delete selected models?'
))
def
action_delete
(
self
,
ids
):
try
:
model_pk
=
getattr
(
self
.
model
,
self
.
_primary_key
)
...
...
flask_admin/model/base.py
View file @
73256448
...
...
@@ -715,13 +715,18 @@ class BaseModelView(BaseView):
return
self
.
_get_url
(
'.index_view'
,
page
,
column
,
desc
,
search
,
filters
)
# Actions
actions
=
filter
(
lambda
x
:
self
.
is_action_allowed
(
x
[
0
]),
self
.
_actions
)
# Actions.
actions
=
[]
actions_confirmation
=
{}
for
act
in
self
.
_actions
:
name
,
text
=
act
if
self
.
is_action_allowed
(
name
):
text
=
unicode
(
text
)
actions_confirmation
=
dict
()
for
act
in
actions
:
name
,
_
=
act
actions_confirmation
[
name
]
=
gettext
(
self
.
_action_data
[
name
][
2
])
actions
.
append
((
name
,
text
))
actions_confirmation
[
name
]
=
unicode
(
self
.
_action_data
[
name
][
2
])
return
self
.
render
(
self
.
list_template
,
data
=
data
,
...
...
flask_admin/templates/admin/model/list.html
View file @
73256448
...
...
@@ -40,7 +40,7 @@
<ul
id=
"action_list"
class=
"dropdown-menu"
>
{% for p in actions %}
<li>
<a
href=
"#"
onclick=
"return
actionE
xecute('{{ p[0] }}');"
>
{{ _gettext(p[1]) }}
</a>
<a
href=
"#"
onclick=
"return
modelActions.e
xecute('{{ p[0] }}');"
>
{{ _gettext(p[1]) }}
</a>
</li>
{% endfor %}
</ul>
...
...
@@ -139,7 +139,7 @@
<tr>
{% if actions %}
<td>
<input
type=
"checkbox"
name=
"rowid"
value=
"{{ get_pk_value(row) }}"
/>
<input
type=
"checkbox"
name=
"rowid"
class=
"action-checkbox"
value=
"{{ get_pk_value(row) }}"
/>
</td>
{% endif %}
<td>
...
...
@@ -177,6 +177,13 @@
<script
src=
"{{ url_for('admin.static', filename='js/bootstrap-datepicker.js') }}"
></script>
<script
src=
"{{ url_for('admin.static', filename='js/form.js') }}"
></script>
<script
src=
"{{ url_for('admin.static', filename='js/filters.js') }}"
></script>
{% if actions %}
<script
src=
"{{ url_for('admin.static', filename='js/actions.js') }}"
></script>
<script
language=
"javascript"
>
var
modelActions
=
new
AdminModelActions
(
'{{ _gettext("Please select at least one model.") }}'
,
{{
actions_confirmation
|
tojson
|
safe
}});
</script>
{% endif %}
{% if filter_groups is not none and filter_data is not none %}
<script
language=
"javascript"
>
var
form
=
new
AdminForm
();
...
...
@@ -184,45 +191,6 @@
{{
admin_view
.
_filter_dict
|
tojson
|
safe
}},
{{
filter_data
|
tojson
|
safe
}},
{{
filter_types
|
tojson
|
safe
}});
// Actions helpers. TODO: Move to separate file
$
(
function
()
{
$
(
'#rowtoggle'
).
change
(
function
()
{
$
(
'td input[type=checkbox]'
).
attr
(
'checked'
,
this
.
checked
);
});
var
actionForm
=
$
(
'#action_form'
);
actionForm
.
submit
(
function
()
{
$
(
'td input[type=checkbox]:checked'
).
each
(
function
()
{
actionForm
.
append
(
$
(
this
).
clone
());
});
});
});
// TODO: Cleanup this mess
var
confirmation
=
{{
actions_confirmation
|
tojson
|
safe
}};
function
actionExecute
(
name
)
{
var
selected
=
$
(
'td input[type=checkbox]:checked'
).
size
();
if
(
selected
==
0
)
{
// TODO: Translation
alert
(
'{{ _gettext("Please select at least one model.") }}'
);
return
false
;
}
var
msg
=
confirmation
[
$
(
'#action_form select'
).
val
()];
if
(
!!
msg
)
if
(
!
confirm
(
msg
))
return
false
;
$
(
'#action_form #action'
).
val
(
name
);
$
(
'#action_form'
).
submit
();
return
false
;
}
</script>
{% endif %}
{% 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