Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
a3ab4d6d
Commit
a3ab4d6d
authored
May 12, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preprare for rendering checkboxes
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
977de2d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
weblate/bootstrap_forms.py
weblate/bootstrap_forms.py
+10
-6
No files found.
weblate/bootstrap_forms.py
View file @
a3ab4d6d
...
...
@@ -19,8 +19,9 @@
#
from
django.forms.forms
import
BoundField
,
Form
from
django.forms.widgets
import
CheckboxInput
from
django.forms.util
import
ErrorList
from
django.utils.html
import
format_html
,
format_html
_join
from
django.utils.html
import
format_html_join
from
django.utils.encoding
import
force_text
...
...
@@ -49,8 +50,11 @@ class BootstrapBoundField(BoundField):
result
=
set
(
classes
.
split
())
else
:
result
=
set
()
# TODO: not for checkbox (should have checkbox class)
result
.
add
(
'form-group'
)
print
self
.
field
.
widget
if
isinstance
(
self
.
field
.
widget
,
CheckboxInput
):
result
.
add
(
'checkbox'
)
else
:
result
.
add
(
'form-group'
)
return
' '
.
join
(
result
)
...
...
@@ -59,7 +63,6 @@ class BootstrapForm(Form):
Adds HTML output in divs and spans.
'''
def
as_div
(
self
):
# TODO: not for checkbox (should have checkbox class)
return
self
.
_html_output
(
normal_row
=
DIV_TEMPLATE
,
error_row
=
u'%s'
,
...
...
@@ -88,6 +91,7 @@ class BootstrapForm(Form):
def
__init__
(
self
,
*
args
,
**
kwargs
):
kwargs
[
'error_class'
]
=
BootstrapErrorList
super
(
BootstrapForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
# TODO: not for checkbox (should have checkbox class)
for
field
in
self
.
fields
:
self
.
fields
[
field
].
widget
.
attrs
[
'class'
]
=
'form-control'
widget
=
self
.
fields
[
field
].
widget
if
not
isinstance
(
widget
,
CheckboxInput
):
widget
.
attrs
[
'class'
]
=
'form-control'
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