Override deform template for checkbox field; fix label behavior
This commit is contained in:
parent
0d144ff58b
commit
63e336d4bb
4 changed files with 17 additions and 1 deletions
|
@ -129,6 +129,7 @@ def make_pyramid_config(settings):
|
|||
if config:
|
||||
config.set_root_factory(Root)
|
||||
else:
|
||||
settings.setdefault('pyramid_deform.template_search_path', 'tailbone:templates/deform')
|
||||
config = Configurator(settings=settings, root_factory=Root)
|
||||
|
||||
# configure user authorization / authentication
|
||||
|
@ -140,6 +141,7 @@ def make_pyramid_config(settings):
|
|||
|
||||
# Bring in some Pyramid goodies.
|
||||
config.include('tailbone.beaker')
|
||||
config.include('pyramid_deform')
|
||||
config.include('pyramid_mako')
|
||||
config.include('pyramid_tm')
|
||||
|
||||
|
|
13
tailbone/templates/deform/checkbox.pt
Normal file
13
tailbone/templates/deform/checkbox.pt
Normal file
|
@ -0,0 +1,13 @@
|
|||
<div class="checkbox">
|
||||
<input tal:define="name name|field.name;
|
||||
true_val true_val|field.widget.true_val;
|
||||
css_class css_class|field.widget.css_class;
|
||||
style style|field.widget.style;
|
||||
oid oid|field.oid"
|
||||
type="checkbox"
|
||||
name="${name}" value="${true_val}"
|
||||
id="${oid}"
|
||||
tal:attributes="checked cstruct == true_val;
|
||||
class css_class;
|
||||
style style;" />
|
||||
</div>
|
|
@ -28,7 +28,7 @@ ${h.csrf_token(request)}
|
|||
% if field.error:
|
||||
<div class="field-error">${field.error.msg}</div>
|
||||
% endif
|
||||
<label for="${field.name}">${field.title}</label>
|
||||
<label for="${field.oid}">${field.title}</label>
|
||||
<div class="field">
|
||||
${field.serialize()|n}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue