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
b778848a
Commit
b778848a
authored
Nov 23, 2014
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #698 from msempere/master
Sorting by modified date
parents
459e79e8
2cb991a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
fileadmin.py
flask_admin/contrib/fileadmin.py
+7
-1
list.html
flask_admin/templates/bootstrap2/admin/file/list.html
+1
-1
list.html
flask_admin/templates/bootstrap3/admin/file/list.html
+1
-1
No files found.
flask_admin/contrib/fileadmin.py
View file @
b778848a
...
...
@@ -4,6 +4,7 @@ import platform
import
re
import
shutil
from
datetime
import
datetime
from
operator
import
itemgetter
from
werkzeug
import
secure_filename
...
...
@@ -353,6 +354,8 @@ class FileAdmin(BaseView, ActionsMixin):
def
is_action_allowed
(
self
,
name
):
if
name
==
'delete'
and
not
self
.
can_delete
:
return
False
elif
name
==
'edit'
and
len
(
self
.
editable_extensions
)
==
0
:
return
False
return
True
...
...
@@ -459,7 +462,7 @@ class FileAdmin(BaseView, ActionsMixin):
rel_path
=
op
.
join
(
path
,
f
)
if
self
.
is_accessible_path
(
rel_path
):
items
.
append
((
f
,
rel_path
,
op
.
isdir
(
fp
),
op
.
getsize
(
fp
)))
items
.
append
((
f
,
rel_path
,
op
.
isdir
(
fp
),
op
.
getsize
(
fp
)
,
op
.
getmtime
(
fp
)
))
# Sort by name
items
.
sort
(
key
=
itemgetter
(
0
))
...
...
@@ -467,6 +470,9 @@ class FileAdmin(BaseView, ActionsMixin):
# Sort by type
items
.
sort
(
key
=
itemgetter
(
2
),
reverse
=
True
)
# Sort by modified date
items
.
sort
(
key
=
lambda
values
:
(
values
[
0
],
values
[
1
],
values
[
2
],
values
[
3
],
datetime
.
fromtimestamp
(
values
[
4
])),
reverse
=
True
)
# Generate breadcrumbs
accumulator
=
[]
breadcrumbs
=
[]
...
...
flask_admin/templates/bootstrap2/admin/file/list.html
View file @
b778848a
...
...
@@ -37,7 +37,7 @@
{% endblock %}
</tr>
</thead>
{% for name, path, is_dir, size in items %}
{% for name, path, is_dir, size
, date
in items %}
<tr>
{% block list_row scoped %}
{% if actions %}
...
...
flask_admin/templates/bootstrap3/admin/file/list.html
View file @
b778848a
...
...
@@ -37,7 +37,7 @@
{% endblock %}
</tr>
</thead>
{% for name, path, is_dir, size in items %}
{% for name, path, is_dir, size
, date
in items %}
<tr>
{% block list_row scoped %}
{% if actions %}
...
...
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