Public reviews are now shown on the public page for the student proposal.
The assigned mentor name has been removed from the public page.
The student proposal view now uses the new getReviewsForEntity method.
Patch by: Lennard de Rijk
Reviewed by:to-be-reviewed
--- a/app/soc/templates/soc/student_proposal/public.html Sun Mar 08 13:11:49 2009 +0000
+++ b/app/soc/templates/soc/student_proposal/public.html Sun Mar 08 13:14:28 2009 +0000
@@ -12,6 +12,7 @@
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
+{% load comments_helpers %}
{% load forms_helpers %}
{% block header_title %}
@@ -23,11 +24,17 @@
<table>
{% readonly_field_as_table_row entity.fields.title.label entity.title %}
{% readonly_field_as_table_row "Student" student_name %}
- {% readonly_field_as_table_row "Mentor" mentor_name %}
{% readonly_field_as_twoline_table_row entity.fields.abstract.label entity.abstract %}
{% readonly_safe_field_as_twoline_table_row entity.fields.content.label entity.content %}
{% readonly_field_as_table_row "Created on" entity.created_on %}
{% readonly_field_as_table_row "Last Modified on" entity.last_modified_on %}
</table>
</p>
+
+<hr/>
+<b>Public Reviews</b>
+{% for review in public_reviews %}
+ {% as_review review %}
+{% endfor %}
+<hr/>
{% endblock %}
--- a/app/soc/views/models/student_proposal.py Sun Mar 08 13:11:49 2009 +0000
+++ b/app/soc/views/models/student_proposal.py Sun Mar 08 13:14:28 2009 +0000
@@ -254,12 +254,12 @@
"""See base.View._public().
"""
+ from soc.logic.models.review import logic as review_logic
+
context['student_name'] = entity.scope.name()
- if entity.mentor:
- context['mentor_name'] = entity.mentor.name()
- else:
- context['mentor_name'] = "No mentor assigned"
+ context['public_reviews'] = review_logic.getReviewsForEntity(entity,
+ is_public=True, order=['created'])
@decorators.merge_params
@decorators.check_access
@@ -555,20 +555,16 @@
# TODO(ljvderijk) listing of total given scores per mentor
# a dict with key as role.user ?
- # get the public reviews
- fields = {'scope': entity,
- 'is_public': True}
+ # order the reviews by ascending creation date
+ order = ['created']
- order = ['modified']
-
- query = review_logic.getQueryForFields(filter=fields, order=order)
- context['public_reviews'] = review_logic.getAll(query)
+ # get the public reviews
+ context['public_reviews'] = review_logic.getReviewsForEntity(entity,
+ is_public=True, order=order)
# get the private reviews
- fields['is_public'] = False
-
- query = review_logic.getQueryForFields(filter=fields, order=order)
- context['private_reviews'] = review_logic.getAll(query)
+ context['private_reviews'] = review_logic.getReviewsForEntity(entity,
+ is_public=False, order=order)
# which button should we show to the mentor?
if mentor: