# HG changeset patch # User Pawel Solyga # Date 1224102242 0 # Node ID d135c8c099672436dcd17ebf698d09be6f546dd0 # Parent 1c96c36b58db1dfc2fbb6d41400f1a31d8955dc1 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 diff -r 1c96c36b58db -r d135c8c09967 app/soc/models/club.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' + diff -r 1c96c36b58db -r d135c8c09967 app/soc/models/group.py --- 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')) diff -r 1c96c36b58db -r d135c8c09967 app/soc/models/organization.py --- 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 diff -r 1c96c36b58db -r d135c8c09967 app/soc/models/school.py --- 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' + diff -r 1c96c36b58db -r d135c8c09967 app/soc/models/sponsor.py --- 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' + diff -r 1c96c36b58db -r d135c8c09967 app/soc/templates/soc/group/list/all.html --- 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 %}

{% 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 %}

{% include list_main %} diff -r 1c96c36b58db -r d135c8c09967 app/soc/templates/soc/group/list/group_heading.html --- 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 @@ Name - Linkname + Link name Short name diff -r 1c96c36b58db -r d135c8c09967 app/soc/templates/soc/group/list/group_row.html --- 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 @@ +onclick="document.location.href='/site/{{ group_type_short|lower }}/profile/{{ data_element.link_name }}'" name="name">
{{ data_element.name }} + href="/site/{{ group_type_short|lower }}/profile/{{ data_element.link_name }}">{{ data_element.name }}
diff -r 1c96c36b58db -r d135c8c09967 app/soc/templates/soc/group/profile/edit.html --- 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 @@

{% 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 %}

diff -r 1c96c36b58db -r d135c8c09967 app/soc/templates/soc/group/profile/public.html --- 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 %}

diff -r 1c96c36b58db -r d135c8c09967 app/soc/templates/soc/site/sponsor/profile/edit.html --- 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 }} - + {% endblock %} \ No newline at end of file diff -r 1c96c36b58db -r d135c8c09967 app/soc/views/site/sponsor/list.py --- 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) diff -r 1c96c36b58db -r d135c8c09967 app/soc/views/site/sponsor/profile.py --- 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)