Include name of entity in the text of the link to the read-only public view
authorTodd Larsen <tlarsen@google.com>
Sat, 22 Nov 2008 08:44:54 +0000
changeset 545 217921e76f50
parent 544 10f9da7e0d17
child 546 850d9a5ad894
Include name of entity in the text of the link to the read-only public view present in the common edit template. Provide a simple method in the Work Model class that aliases the existing 'title' Property to 'name'. Patch by: Todd Larsen
app/soc/models/work.py
app/soc/templates/soc/models/edit.html
--- a/app/soc/models/work.py	Sat Nov 22 08:40:10 2008 +0000
+++ b/app/soc/models/work.py	Sat Nov 22 08:44:54 2008 +0000
@@ -91,3 +91,9 @@
   is_featured.help_text = ugettext_lazy(
       'Field used to indicate if a Work should be featured, for example,'
       ' in the sidebar menu.')
+
+  def name(self):
+    """Alias 'title' Property as 'name' for use in common templates.
+    """
+    return self.title
+
--- a/app/soc/templates/soc/models/edit.html	Sat Nov 22 08:40:10 2008 +0000
+++ b/app/soc/templates/soc/models/edit.html	Sat Nov 22 08:44:54 2008 +0000
@@ -20,7 +20,8 @@
 {{ page_name }}
  {% if entity %}
    <!-- TODO(srabbelier) use a generic entity name as link -->
-   <a href="/{{ entity_type_url|lower }}/show/{{ entity_suffix }}">(Public page)</a>
+   <a href="/{{ entity_type_url|lower }}/show/{{ entity_suffix }}"
+>{% if entity.name %}{{ entity.name }} {% endif %}(public view)</a>
  {% endif %}
 {% endblock %}