Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use field.verbose_name and display field.help_text if exists

  • Loading branch information...
commit 312cf2f25bc342069aab595a16b971cf6b596eb1 1 parent b32c8ec
@jedie authored
View
2  reversion_compare/admin.py
@@ -302,7 +302,7 @@ def compare(self, obj, version1, version2):
html = self._get_compare(obj_compare)
diff.append({
- "field_name": field_name,
+ "field": field,
"diff": html
})
return diff
View
7 reversion_compare/templates/reversion-compare/compare.html
@@ -27,14 +27,15 @@
{% block content %}
<div id="content-main">
- <p>
+ <p class="help">
{% blocktrans with date1=version1.revision.date_created|date:_("DATETIME_FORMAT") date2=version2.revision.date_created|date:_("DATETIME_FORMAT") %}
Compare <strong>{{ date1 }}</strong> with <strong>{{ date2 }}</strong>:
{% endblocktrans %}
</p>
&lsaquo; <a href="{{history_url}}">{% trans "Go back to history list" %}</a>
{% for field_diff in compare_data %}
- <h3>{{ field_diff.field_name}}</h3>
+ <h3>{{ field_diff.field.verbose_name }}</h3>
+ {% if field_diff.field.help_text %}<p class="help">{{ field_diff.field.help_text }}</p>{% endif %}
<div class="module">
<p>{{ field_diff.diff }}</p>
</div>
@@ -44,7 +45,7 @@
</div>
{% endfor %}
<p>
- {% trans "Comment:" %} <blockquote>{{ version2.revision.comment|default:"" }}</blockquote>
+ {% trans "Edit comment:" %} <blockquote>{{ version2.revision.comment|default:"" }}</blockquote>
</p>
&lsaquo; <a href="{{history_url}}">{% trans "Go back to history list" %}</a>
</div>
View
2  reversion_compare_test_project/reversion_compare_test_app/models.py
@@ -49,5 +49,5 @@ class FlatExampleModel(models.Model):
date_created = models.DateTimeField(auto_now_add=True)
last_update = models.DateTimeField(auto_now=True)
user = models.ForeignKey(User)
- content = models.TextField()
+ content = models.TextField(help_text="Here is a content text field and this line is the help text from the model field.")
child_model = models.ForeignKey(ChildModel, blank=True, null=True)
Please sign in to comment.
Something went wrong with that request. Please try again.