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
a915a5b3
Commit
a915a5b3
authored
Jul 21, 2013
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor CSS changes, fixed mongoengine field ordering
parent
cbd5846a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
7 deletions
+54
-7
form.py
flask_admin/contrib/mongoengine/form.py
+4
-1
helpers.py
flask_admin/contrib/mongoengine/helpers.py
+25
-0
typefmt.py
flask_admin/contrib/mongoengine/typefmt.py
+1
-1
widgets.py
flask_admin/contrib/mongoengine/widgets.py
+2
-2
admin.css
flask_admin/static/admin/css/admin.css
+18
-0
inline_form.html
flask_admin/templates/admin/model/inline_form.html
+3
-2
inline_list_base.html
flask_admin/templates/admin/model/inline_list_base.html
+1
-1
No files found.
flask_admin/contrib/mongoengine/form.py
View file @
a915a5b3
from
operator
import
attrgetter
from
mongoengine
import
ReferenceField
from
mongoengine
import
ReferenceField
from
mongoengine.base
import
BaseDocument
,
DocumentMetaclass
from
mongoengine.base
import
BaseDocument
,
DocumentMetaclass
...
@@ -167,7 +169,8 @@ def get_form(model, converter,
...
@@ -167,7 +169,8 @@ def get_form(model, converter,
field_args
=
field_args
or
{}
field_args
=
field_args
or
{}
# Find properties
# Find properties
properties
=
((
k
,
v
)
for
k
,
v
in
iteritems
(
model
.
_fields
))
properties
=
sorted
(((
k
,
v
)
for
k
,
v
in
iteritems
(
model
.
_fields
)),
key
=
lambda
v
:
v
[
1
]
.
creation_counter
)
if
only
:
if
only
:
props
=
dict
(
properties
)
props
=
dict
(
properties
)
...
...
flask_admin/contrib/mongoengine/helpers.py
0 → 100644
View file @
a915a5b3
def
make_gridfs_args
(
value
):
args
=
{
'id'
:
value
.
grid_id
,
'coll'
:
value
.
collection_name
}
if
value
.
db_alias
!=
'default'
:
args
[
'db'
]
=
value
.
db_alias
return
args
def
make_thumb_args
(
value
):
if
value
.
thumbnail
:
args
=
{
'id'
:
value
.
thumbnail
.
_id
,
'coll'
:
value
.
collection_name
}
if
value
.
db_alias
!=
'default'
:
args
[
'db'
]
=
value
.
db_alias
return
args
else
:
return
make_gridfs_args
(
value
)
flask_admin/contrib/mongoengine/typefmt.py
View file @
a915a5b3
...
@@ -18,7 +18,7 @@ def grid_formatter(view, value):
...
@@ -18,7 +18,7 @@ def grid_formatter(view, value):
'</a>
%(size)
dk (
%(content_type)
s)'
)
%
'</a>
%(size)
dk (
%(content_type)
s)'
)
%
{
{
'url'
:
url_for
(
'.api_file_view'
,
**
args
),
'url'
:
url_for
(
'.api_file_view'
,
**
args
),
'name'
:
escape
(
value
.
file
name
),
'name'
:
escape
(
value
.
name
),
'size'
:
value
.
length
//
1024
,
'size'
:
value
.
length
//
1024
,
'content_type'
:
escape
(
value
.
content_type
)
'content_type'
:
escape
(
value
.
content_type
)
})
})
...
...
flask_admin/contrib/mongoengine/widgets.py
View file @
a915a5b3
...
@@ -17,10 +17,10 @@ class MongoFileInput(object):
...
@@ -17,10 +17,10 @@ class MongoFileInput(object):
placeholder
=
''
placeholder
=
''
if
field
.
data
:
if
field
.
data
:
data
=
field
.
data
.
fs
data
=
field
.
data
placeholder
=
self
.
template
%
{
placeholder
=
self
.
template
%
{
'name'
:
escape
(
data
.
file
name
),
'name'
:
escape
(
data
.
name
),
'content_type'
:
escape
(
data
.
content_type
),
'content_type'
:
escape
(
data
.
content_type
),
'size'
:
data
.
length
//
1024
'size'
:
data
.
length
//
1024
}
}
...
...
flask_admin/static/admin/css/admin.css
View file @
a915a5b3
...
@@ -83,6 +83,24 @@ table.filters {
...
@@ -83,6 +83,24 @@ table.filters {
max-height
:
100px
;
max-height
:
100px
;
}
}
/* Forms */
.form-horizontal
.control-label
{
width
:
100px
;
text-align
:
left
;
margin-left
:
4px
;
}
.form-horizontal
.controls
{
margin-left
:
110px
;
}
/* Inline forms */
.inline-field
.inline-form
{
border-left
:
1px
solid
#eeeeee
;
padding-left
:
8px
;
margin-bottom
:
4px
;
}
/* Patch Select2 */
/* Patch Select2 */
.select2-results
li
{
.select2-results
li
{
min-height
:
24px
!important
;
min-height
:
24px
!important
;
...
...
flask_admin/templates/admin/model/inline_form.html
View file @
a915a5b3
{% import 'admin/lib.html' as lib with context %}
{% import 'admin/lib.html' as lib with context %}
{{ lib.render_form_fields(field, False) }}
<div
class=
"inline-form"
>
<hr/>
{{ lib.render_form_fields(field, False) }}
</div>
flask_admin/templates/admin/model/inline_list_base.html
View file @
a915a5b3
{% macro render_inline_fields(field, template, render, check=None) %}
{% macro render_inline_fields(field, template, render, check=None) %}
<div
class=
"
well
"
>
<div
class=
"
inline-field
"
>
<div
id=
"{{ field.id }}-fields"
>
<div
id=
"{{ field.id }}-fields"
>
{% for subfield in field %}
{% for subfield in field %}
<div
id=
"{{ subfield.id }}"
class=
"fa-inline-field"
>
<div
id=
"{{ subfield.id }}"
class=
"fa-inline-field"
>
...
...
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