Skip to content

Commit

Permalink
Merge branch 'release-0.6.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
chipx86 committed Jun 5, 2012
2 parents 99ce882 + 7ccac7a commit 82b13c0
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 6 deletions.
19 changes: 19 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
version 0.6.18 final (5-June-2012):
* djblets.siteconfig:
* Settings form rows in the template now have IDs indicating the row
(in the form of "row-{{fieldname}}") and CSS class names
("field-{{fieldname}}").

* Help text for fields are now marked as safe, so that the contents
aren't escaped.

* The form's disabled_reasons is no longer assumed to be populated.

* The initial field values are now always set. Previously, they would
only be set if the field type was a boolean, or the value didn't
evaluate to false, which broke numeric fields set to 0.

* djblets.util:
* Added a json_dumps filter, which serialized a value to JSON.


version 0.6.17 final (2-April-2012):
* djblets.gravatars:
* Gravatars are no longer hard-coded to be jpegs. This was
Expand Down
4 changes: 1 addition & 3 deletions djblets/siteconfig/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ def load(self):
"""
for field in self.fields:
value = self.siteconfig.get(field)

if isinstance(value, bool) or value:
self.fields[field].initial = value
self.fields[field].initial = value

if field in self.disabled_fields:
self.fields[field].widget.attrs['disabled'] = 'disabled'
Expand Down
6 changes: 3 additions & 3 deletions djblets/siteconfig/templates/siteconfig/settings_field.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
{{field}}
{% else %}
{% with field|form_field_has_label_first as label_first %}
<div class="form-row{% if not label_first %} checkbox-row{% endif%}{% if field.errors %} error{% endif %}">
<div class="form-row{% if not label_first %} checkbox-row{% endif%}{% if field.errors %} error{% endif %}{% if field.name %} field-{{field.name}}{% endif %}" {% if field.name %} id="row-{{field.name}}"{% endif %}>
{{field.errors}}
{% if not label_first %}{{field}}{% endif %}
{% if not form.fields_no_label %}{% label_tag field %}{% endif %}
{% if label_first %}{{field}}{% endif %}
{% if field.help_text %}<p class="help">{{field.help_text}}</p>{% endif %}
{% if form.disabled_reasons|contains:field.name %}<p class="disabled-reason">{{form.disabled_reasons|getitem:field.name|safe}}</p>{% endif %}
{% if field.help_text %}<p class="help">{{field.help_text|safe}}</p>{% endif %}
{% if form.disabled_reasons|default:''|contains:field.name %}<p class="disabled-reason">{{form.disabled_reasons|getitem:field.name|safe}}</p>{% endif %}
</div>
{% endwith %}
{% endif %}
15 changes: 15 additions & 0 deletions djblets/util/templatetags/djblets_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@


from django import template
from django.core.serializers import serialize
from django.db.models.query import QuerySet
from django.utils import simplejson
from django.utils.safestring import mark_safe


register = template.Library()
Expand Down Expand Up @@ -57,3 +61,14 @@ def form_dialog_fields(form):

# Chop off the last ','
return "[ %s ]" % s[:-1]



@register.filter
def json_dumps(value, indent=0):
if isinstance(value, QuerySet):
result = serialize('json', value, indent=indent)
else:
result = simplejson.dumps(value, indent=indent)

return mark_safe(result)

0 comments on commit 82b13c0

Please sign in to comment.