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
b7f53eb9
Commit
b7f53eb9
authored
Feb 04, 2013
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor template cleanup and ignore multicolumn properties when sorting
parent
3920b966
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
33 deletions
+36
-33
view.py
flask_admin/contrib/sqlamodel/view.py
+2
-3
lib.html
flask_admin/templates/admin/lib.html
+34
-30
No files found.
flask_admin/contrib/sqlamodel/view.py
View file @
b7f53eb9
...
...
@@ -316,9 +316,8 @@ class ModelView(BaseModelView):
if
hasattr
(
p
,
'columns'
):
# Sanity check
if
len
(
p
.
columns
)
>
1
:
raise
Exception
(
'Automatic form scaffolding is not supported'
+
' for multi-column properties (
%
s.
%
s)'
%
(
self
.
model
.
__name__
,
p
.
key
))
# Multi-column properties are not supported
continue
column
=
p
.
columns
[
0
]
...
...
flask_admin/templates/admin/lib.html
View file @
b7f53eb9
...
...
@@ -73,40 +73,44 @@
{% endif %}
{%- endmacro %}
{% macro render_field(form, field, focus_set=False) %}
<div
class=
"control-group{{ ' error' if field.errors }}"
>
<div
class=
"control-label"
>
{{ field.label.text }}
{% if h.is_required_form_field(field) %}
<strong
style=
"color: red"
>
*
</strong>
{% else %}
{% endif %}
</div>
<div
class=
"controls"
>
<div>
{% if not focus_set %}
{{ field(autofocus='autofocus')|safe }}
{% set focus_set = True %}
{% else %}
{{ field()|safe }}
{% endif %}
</div>
{% if field.description %}
<p
class=
"help-block"
>
{{ field.description }}
</p>
{% endif %}
{% if field.errors %}
<ul>
{% for e in field.errors if e is string %}
<li>
{{ e }}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{% endmacro %}
{% macro render_form_fields(form, focus_set=False) %}
{{ form.hidden_tag() if form.hidden_tag is defined }}
{% for f in form if f.type != 'HiddenField' and f.type != 'CSRFTokenField' %}
<div
class=
"control-group{{ ' error' if f.errors }}"
>
<div
class=
"control-label"
>
{{ f.label.text }}
{% if h.is_required_form_field(f) %}
<strong
style=
"color: red"
>
*
</strong>
{% else %}
{% endif %}
</div>
<div
class=
"controls"
>
<div>
{% if not focus_set %}
{{ f(autofocus='autofocus')|safe }}
{% set focus_set = True %}
{% else %}
{{ f()|safe }}
{% endif %}
</div>
{% if f.description %}
<p
class=
"help-block"
>
{{ f.description }}
</p>
{% endif %}
{% if f.errors %}
<ul>
{% for e in f.errors if e is string %}
<li>
{{ e }}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{{ render_field(form, f, focus_set) }}
{% endfor %}
{% endmacro %}
...
...
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