[damned-lies] Properly display comment field
- From: Claude Paroz <claudep src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [damned-lies] Properly display comment field
- Date: Tue, 6 Oct 2009 08:05:10 +0000 (UTC)
commit 47bcbf230d10f82a372a498c6382ed9440966d8a
Author: Claude Paroz <claude 2xlibre net>
Date: Tue Oct 6 10:02:28 2009 +0200
Properly display comment field
Before the difficulty to translate AND mark safe a string in Django
template language (is it doable?), I added an accessor get_comment
method to retrieve the translated comment.
stats/models.py | 8 ++++----
templates/module_detail.html | 4 ++--
templates/vertimus/vertimus_detail.html | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 26d27ed..c94e883 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -79,10 +79,10 @@ class Module(models.Model):
#FIXME: delete and recreate branch if vcs_root changed?
def get_description(self):
- if self.description:
- return _(self.description)
- else:
- return self.name
+ return self.description and _(self.description) or self.name
+
+ def get_comment(self):
+ return self.comment and _(self.comment) or ""
def has_standard_vcs(self):
""" This function checks if the module is hosted in the standard VCS of the project """
diff --git a/templates/module_detail.html b/templates/module_detail.html
index 42aedba..9cefe84 100644
--- a/templates/module_detail.html
+++ b/templates/module_detail.html
@@ -36,8 +36,8 @@ $(document).ready(function() {
<h1>{{ module.get_description }}</h1>
-{% if module.comment %}
- <p>{% trans module.comment %}</p>
+{% if module.get_comment %}
+ <p>{{ module.get_comment|safe }}</p>
{% else %}
{% if not module.has_standard_vcs %}
<p><em><img src="/media/img/warn.png" alt="Warning logo" /> {{ non_standard_repo_msg }}</em></p>
diff --git a/templates/vertimus/vertimus_detail.html b/templates/vertimus/vertimus_detail.html
index 6c21ed2..eceb239 100644
--- a/templates/vertimus/vertimus_detail.html
+++ b/templates/vertimus/vertimus_detail.html
@@ -48,8 +48,8 @@ $(document).ready(function() {
{% endifnotequal %}
</h2>
-{% if module.comment %}
- <p>{{ module.comment|safe }}</p>
+{% if module.get_comment %}
+ <p>{{ module.get_comment|safe }}</p>
{% else %}
{% if not module.has_standard_vcs %}
<p><em><img src="{{ MEDIA_URL }}img/warn.png" alt="Warning logo" /> {{ non_standard_repo_msg }}</em></p>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]