Skip to content

Commit

Permalink
some fixes, checkbox is now reverted
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Greenfeld <[email protected]>
  • Loading branch information
Patrick Lauber authored and pydanny committed Jun 22, 2009
1 parent 02054dd commit d443d56
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
38 changes: 25 additions & 13 deletions uni_form/templates/uni_form/field.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
{% load uni_form_field %}
{% if field.is_hidden %}
{{ field }}
{% else %}
<div id="div_{{ field.auto_id }}" class="ctrlHolder {% if field.errors %}error{% endif %}">
<div id="div_{{ field.auto_id }}" class="ctrlHolder{% if field.errors %} error{% endif %}{% if field|is_checkbox %} checkbox{% endif %}">
{% if field|is_checkbox %}
{{ field|with_class }}
{% if field.label %}
<label for="{{ field.auto_id }}">
{{ field.label }}{% if field.field.required %}*{% endif %}
</label>
{% endif %}
{% else %}
{% if field.label %}
<label for="{{ field.auto_id }}">
{{ field.label }}{% if field.field.required %}*{% endif %}
</label>
{% endif %}
{{ field|with_class }}
{% endif %}

{% for error in field.errors %}
<p id="error_{{ field.auto_id }}" class="errorField">
<strong>{{ error }}</strong>
{{ error }}
</p>
{% endfor %}
{% if field.label %}
<label for="{{ field.auto_id }}">
{% if field.field.required %}*{% endif %}
{{ field.label }}
</label>
{% endif %}
{{ field }}
{% if field.help_text %}
{% endfor %}

{% if field.help_text %}
<p id="hint_{{ field.auto_id }}" class="formHint">{{ field.help_text }}</p>
{% endif %}
{% endif %}
</div>
{% endif %}
{% endif %}

6 changes: 3 additions & 3 deletions uni_form/templates/uni_form/whole_uni_form.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% load uni_form %}
{% load uni_form i18n %}

<form action="" class="uniForm {{ form_class }}" method="post" id="{{ form_id|slugify }}" {% if form.is_multipart %}enctype="multipart/form-data"{% endif %}>
{% if form_html %}{{ form_html }}{% else %}
<fieldset class="inlineLabels">
<legend>* Required fields</legend>
{{ form|as_uni_form }}
<legend>* {% trans "Required fields" %}</legend>
{{ form|as_uni_form }}
</fieldset>
{% endif %}
{% if inputs %}
Expand Down
2 changes: 2 additions & 0 deletions uni_form/templatetags/uni_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ def get_render(self, context):

if helper and helper.layout:
form_html = helper.render_layout(actual_form)
else:
form_html = ""
response_dict = {
'form':actual_form,
'form_html':form_html,
Expand Down

0 comments on commit d443d56

Please sign in to comment.