Change verbose_name of founder property in Group model from "Created by" to "Founded by". Add GROUP_TYPE_SHORT and GROUP_TYPE_PLURAL for all models that inherit from Group and use that values in templates and contexts. Assume that group_type, group_type_short and group_type_plural are defined in context and remove not needed ifs in templates. Rename "Linkname" to "Link name" in list/group_heading.html template.
authorPawel Solyga <Pawel.Solyga@gmail.com>
Wed, 15 Oct 2008 20:24:02 +0000
changeset 344 d135c8c09967
parent 343 1c96c36b58db
child 345 27c3c63da9ac
Change verbose_name of founder property in Group model from "Created by" to "Founded by". Add GROUP_TYPE_SHORT and GROUP_TYPE_PLURAL for all models that inherit from Group and use that values in templates and contexts. Assume that group_type, group_type_short and group_type_plural are defined in context and remove not needed ifs in templates. Rename "Linkname" to "Link name" in list/group_heading.html template. Patch by: Pawel Solyga Review by: to-be-reviewed
app/soc/models/club.py
app/soc/models/group.py
app/soc/models/organization.py
app/soc/models/school.py
app/soc/models/sponsor.py
app/soc/templates/soc/group/list/all.html
app/soc/templates/soc/group/list/group_heading.html
app/soc/templates/soc/group/list/group_row.html
app/soc/templates/soc/group/profile/edit.html
app/soc/templates/soc/group/profile/public.html
app/soc/templates/soc/site/sponsor/profile/edit.html
app/soc/views/site/sponsor/list.py
app/soc/views/site/sponsor/profile.py
--- a/app/soc/models/club.py	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/models/club.py	Wed Oct 15 20:24:02 2008 +0000
@@ -40,5 +40,9 @@
      relation is implemented as the 'members' back-reference Query of the
      Member model 'club' reference.
   """
-  pass
 
+  #: Group type short name used for example in urls
+  GROUP_TYPE_SHORT = 'club'
+  #: Group type plural name used in Group templates
+  GROUP_TYPE_PLURAL = 'Clubs'
+
--- a/app/soc/models/group.py	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/models/group.py	Wed Oct 15 20:24:02 2008 +0000
@@ -61,7 +61,8 @@
   #: creation limits, used to prevent spamming, etc.).
   founder = db.ReferenceProperty(reference_class=soc.models.user.User,
                                  required=True, collection_name="groups",
-                                 verbose_name=ugettext_lazy('Created by'))
+                                 verbose_name=ugettext_lazy('Founded by'))
+
   #: Required field storing a home page URL of the group.
   home_page = db.LinkProperty(required=True,
       verbose_name=ugettext_lazy('Home Page URL'))
--- a/app/soc/models/organization.py	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/models/organization.py	Wed Oct 15 20:24:02 2008 +0000
@@ -39,4 +39,8 @@
      'reviewers' back-reference Query of the Organization model 'org'
      reference.
   """
-  pass
\ No newline at end of file
+
+  #: Group type short name used for example in urls
+  GROUP_TYPE_SHORT = 'org'
+  #: Group type plural name used in Group templates
+  GROUP_TYPE_PLURAL = 'Organizations'
\ No newline at end of file
--- a/app/soc/models/school.py	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/models/school.py	Wed Oct 15 20:24:02 2008 +0000
@@ -40,5 +40,9 @@
      belonging to) a School.  This relation is implemented as the 'students'
      back-reference Query of the Student model 'school' reference.
   """
-  pass
 
+  #: Group type short name used for example in urls
+  GROUP_TYPE_SHORT = 'school'
+  #: Group type plural name used in Group templates
+  GROUP_TYPE_PLURAL = 'Schools'
+
--- a/app/soc/models/sponsor.py	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/models/sponsor.py	Wed Oct 15 20:24:02 2008 +0000
@@ -29,5 +29,9 @@
 
 class Sponsor(soc.models.group.Group):
   """Sponsor details."""
-  pass
 
+  #: Group type short name used for example in urls
+  GROUP_TYPE_SHORT = 'sponsor'
+  #: Group type plural name used in Group templates
+  GROUP_TYPE_PLURAL = 'Sponsors'
+
--- a/app/soc/templates/soc/group/list/all.html	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/templates/soc/group/list/all.html	Wed Oct 15 20:24:02 2008 +0000
@@ -14,16 +14,16 @@
 {% endcomment %}
 {% load forms_helpers %}
 {% block page_title %}
-Site: {% if group_type %}{{ group_type }}{% else %}Group{% endif %}s List
+Site: {{ group_type_plural }} List
 {% endblock %}
 {% block header_title %}
-{% if group_type %}{{ group_type }}{% else %}Group{% endif %}s List
+{{ group_type_plural }} List
 {% endblock %}
 {% block body %}
 <p>
 <p>
 {% block instructions %}
-List of {% if group_type %}{{ group_type }}{% else %}Group{% endif %}s in Google Open Source Programs.
+List of {{ group_type_plural }} in Google Open Source Programs.
 {% endblock %}
 </p>
 {% include list_main %}
--- a/app/soc/templates/soc/group/list/group_heading.html	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/templates/soc/group/list/group_heading.html	Wed Oct 15 20:24:02 2008 +0000
@@ -1,5 +1,5 @@
 <tr align="left">
   <th class="first" align="right">Name</th>
-  <th>Linkname</th>
+  <th>Link name</th>
   <th>Short name</th>
 </tr>
--- a/app/soc/templates/soc/group/list/group_row.html	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/templates/soc/group/list/group_row.html	Wed Oct 15 20:24:02 2008 +0000
@@ -1,7 +1,7 @@
 <tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'" 
-onclick="document.location.href='/site/{{ group_type|lower }}/profile/{{ data_element.link_name }}'" name="name">
+onclick="document.location.href='/site/{{ group_type_short|lower }}/profile/{{ data_element.link_name }}'" name="name">
   <td align="right"><div class="name"><a class="noul"
-         href="/site/{{ group_type|lower }}/profile/{{ data_element.link_name }}">{{ data_element.name }}</a>
+         href="/site/{{ group_type_short|lower }}/profile/{{ data_element.link_name }}">{{ data_element.name }}</a>
      </div>
   </td>
   <td><div class="link_name">{{ data_element.link_name }}</a></div></td>
--- a/app/soc/templates/soc/group/profile/edit.html	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/templates/soc/group/profile/edit.html	Wed Oct 15 20:24:02 2008 +0000
@@ -19,16 +19,16 @@
 
 {% block page_title %}
 {% if existing_group %}
-Site: Modify Existing {% if group_type %}{{ group_type }}{% else %}Group{% endif %}
+Site: Modify Existing {{ group_type }}
 {% else %}
-Site: Create New {% if group_type %}{{ group_type }}{% else %}Group{% endif %}
+Site: Create New {{ group_type }}
 {% endif %}
 {% endblock %}
 {% block header_title %}
 {% if existing_group %}
-Modify Existing {% if group_type %}{{ group_type }}{% else %}Group{% endif %}
+Modify Existing {{ group_type }}
 {% else %}
-Create a New {% if group_type %}{{ group_type }}{% else %}Group{% endif %}
+Create a New {{ group_type }}
 {% endif %}
 {% endblock %}
 
@@ -36,7 +36,7 @@
 <p>
 <p>
 {% block instructions %}
-Please use this form to alter {% if group_type %}{{ group_type }}{% else %}Group{% endif %} details.
+Please use this form to alter {{ group_type }} details.
 {% endblock %}
 </p>
 <form method="POST">
--- a/app/soc/templates/soc/group/profile/public.html	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/templates/soc/group/profile/public.html	Wed Oct 15 20:24:02 2008 +0000
@@ -13,9 +13,9 @@
 limitations under the License.
 {% endcomment %}
 {% load forms_helpers %}
-{% block page_title %}{% if group_type %}{{ group_type }}{% else %}Group{% endif %} Public Profile{% endblock %}
+{% block page_title %}{{ group_type }} Public Profile{% endblock %}
 {% block header_title %}
-{% if group_type %}{{ group_type }}{% else %}Group{% endif %} Public Profile for {{ link_name_group.name }}
+{{ group_type }} Public Profile for {{ link_name_group.name }}
 {% endblock %}
 {% block body %}
 <p>
--- a/app/soc/templates/soc/site/sponsor/profile/edit.html	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/templates/soc/site/sponsor/profile/edit.html	Wed Oct 15 20:24:02 2008 +0000
@@ -15,6 +15,6 @@
  {% block submit_buttons %}
  {{ block.super }}
 <td>
- <input type="button" onclick="location.href='/site/sponsor/profile/{{ existing_group.link_name }}/delete'" value="Delete"/>
+ <input type="button" onclick="location.href='/site/{{ group_type_short|lower }}/profile/{{ existing_group.link_name }}/delete'" value="Delete"/>
 </td>
  {% endblock %}
\ No newline at end of file
--- a/app/soc/views/site/sponsor/list.py	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/views/site/sponsor/list.py	Wed Oct 15 20:24:02 2008 +0000
@@ -29,6 +29,7 @@
 from soc.views.helper import access
 
 import soc.logic
+import soc.models.sponsor as sponsor_model
 import soc.views.helper.lists
 import soc.views.helper.responses
 import soc.views.out_of_band
@@ -66,6 +67,8 @@
                                  offset=offset, limit=limit, 
                                  list_templates=list_templates)
                                  
-  context['group_type'] = 'Sponsor'
+  context.update({'group_type': 'Sponsor',
+                  'group_type_plural': sponsor_model.Sponsor.GROUP_TYPE_PLURAL,
+                  'group_type_short': sponsor_model.Sponsor.GROUP_TYPE_SHORT})
 
   return helper.responses.respond(request, template, context)
--- a/app/soc/views/site/sponsor/profile.py	Wed Oct 15 20:10:07 2008 +0000
+++ b/app/soc/views/site/sponsor/profile.py	Wed Oct 15 20:24:02 2008 +0000
@@ -38,7 +38,7 @@
 from soc.views.user import profile
 
 import soc.logic
-import soc.models.sponsor
+import soc.models.sponsor as sponsor_model
 import soc.views.helper.forms
 import soc.views.helper.requests
 import soc.views.helper.responses
@@ -53,7 +53,7 @@
     """Inner Meta class that defines some behavior for the form.
     """
     #: db.Model subclass for which the form will gather information
-    model = soc.models.sponsor.Sponsor
+    model = sponsor_model.Sponsor
     
     #: list of model fields which will *not* be gathered by the form
     exclude = ['founder', 'inheritance_line']
@@ -72,7 +72,7 @@
   """Django form displayed when editing a Sponsor.
   """
   link_name = forms.CharField(widget=helper.widgets.ReadOnlyInput())
-  created_by = forms.CharField(widget=helper.widgets.ReadOnlyInput(),
+  founded_by = forms.CharField(widget=helper.widgets.ReadOnlyInput(),
                                required=False)
 
   def clean_link_name(self):
@@ -180,7 +180,7 @@
       # populate form with the existing Sponsor entity
       founder_link_name = existing_sponsor.founder.link_name
       sponsor_form = EditForm(instance=existing_sponsor, 
-                              initial={'created_by': founder_link_name})
+                              initial={'founded_by': founder_link_name})
     else:
       if request.GET.get(profile.SUBMIT_MSG_PARAM_NAME):
         # redirect to aggressively remove 'Profile saved' query parameter
@@ -191,7 +191,8 @@
     
   context.update({'form': sponsor_form,
                   'existing_group':  existing_sponsor,
-                  'group_type': 'Sponsor'})
+                  'group_type': 'Sponsor',
+                  'group_type_short': sponsor_model.Sponsor.GROUP_TYPE_SHORT})
 
   return helper.responses.respond(request, template, context)