Changed the workflow for students regarding their proposals.
authorLennard de Rijk <ljvderijk@gmail.com>
Fri, 13 Mar 2009 23:04:27 +0000
changeset 1840 bf2c705ead19
parent 1839 92b28d1bf2f5
child 1841 d7ac10b583fb
Changed the workflow for students regarding their proposals. The list_self for students now points to the public page where they can see their public reviews. A link on this page has been added to point to the view where they can edit their proposal. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/templates/soc/student_proposal/public.html
app/soc/views/models/student_proposal.py
--- a/app/soc/templates/soc/student_proposal/public.html	Fri Mar 13 23:01:11 2009 +0000
+++ b/app/soc/templates/soc/student_proposal/public.html	Fri Mar 13 23:04:27 2009 +0000
@@ -17,6 +17,9 @@
 
 {% block header_title %}
 {{ page_name }} "{{ entity.title }}" from {{ student_name }}
+{% if edit_link %}
+<a href='{{ edit_link }}'>(Edit my Proposal)</a>
+{% endif %}
 {% endblock %}
 
 {% block body %}
--- a/app/soc/views/models/student_proposal.py	Fri Mar 13 23:01:11 2009 +0000
+++ b/app/soc/views/models/student_proposal.py	Fri Mar 13 23:04:27 2009 +0000
@@ -390,7 +390,16 @@
 
     from soc.logic.models.review import logic as review_logic
 
-    context['student_name'] = entity.scope.name()
+    student_entity = entity.scope
+
+    context['student_name'] = student_entity.name()
+
+    user_entity = user_logic.logic.getForCurrentAccount()
+
+    # check if the current user is the student
+    if user_entity.key() == student_entity.user.key():
+      # show the proposal edit link
+      context['edit_link'] = redirects.getEditRedirect(entity, params)
 
     context['public_reviews'] = review_logic.getReviewsForEntity(entity,
         is_public=True, order=['created'])