Renamed Comments to Reviews.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Mon, 10 Aug 2009 01:00:32 +0530
changeset 26 97bd3c28c957
parent 25 a6a5e45f68c8
child 27 37612f295cd4
Renamed Comments to Reviews.
app/projrev/models.py
app/projrev/views/helpers/forms.py
app/projrev/views/helpers/templatetags/comments_helpers.py
app/projrev/views/helpers/templatetags/review_helpers.py
app/projrev/views/proposal.py
app/templates/projrev/proposal/review.html
app/templates/projrev/templatetags/_as_comment.html
app/templates/projrev/templatetags/_as_review.html
--- a/app/projrev/models.py	Mon Aug 10 00:40:47 2009 +0530
+++ b/app/projrev/models.py	Mon Aug 10 01:00:32 2009 +0530
@@ -849,7 +849,7 @@
   reviewer = models.ForeignKey(User, null=True)
 
   #: Field containing the date and time of review of the proposal.
-  reviewed_on = models.DateTimeField(auto_now_add=True)
+  reviewed_on = models.DateTimeField(auto_now=True)
 
   #: Field containing the review value for this attribute.
   attribute1 = models.PositiveSmallIntegerField(
--- a/app/projrev/views/helpers/forms.py	Mon Aug 10 00:40:47 2009 +0530
+++ b/app/projrev/views/helpers/forms.py	Mon Aug 10 01:00:32 2009 +0530
@@ -8,6 +8,7 @@
 
 
 from django import forms
+from django.contrib.auth.models import User
 
 from projrev.models import Project
 from projrev.models import Review
@@ -36,9 +37,10 @@
   project = forms.ModelChoiceField(queryset=Project.objects.all(), 
                                    widget=forms.HiddenInput(),
                                    required=False)
+  reviewer = forms.ModelChoiceField(queryset=User.objects.all(), 
+                                    widget=forms.HiddenInput(),
+                                    required=False)
 
   class Meta:
     # Create a form from Review data model.
     model = Review
-
-    exclude = ('reviewer')
--- a/app/projrev/views/helpers/templatetags/comments_helpers.py	Mon Aug 10 00:40:47 2009 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-"""A Django template tag library containing forms helpers.
-"""
-
-__authors__ = [
-  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
-]
-
-
-from django import template
-
-register = template.Library()
-
-
-@register.inclusion_tag('projrev/templatetags/_as_comment.html')
-def as_comment(user):
-  """Prints a user as a hyperlinked link_id.
-  """
-
-  return {'user': user}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/projrev/views/helpers/templatetags/review_helpers.py	Mon Aug 10 01:00:32 2009 +0530
@@ -0,0 +1,19 @@
+"""A Django template tag library containing forms helpers.
+"""
+
+__authors__ = [
+  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
+]
+
+
+from django import template
+
+register = template.Library()
+
+
+@register.inclusion_tag('projrev/templatetags/_as_comment.html')
+def as_comment(review):
+  """Returns the comment contexts for the template tag.
+  """
+
+  return {'comment_entity': review}
--- a/app/projrev/views/proposal.py	Mon Aug 10 00:40:47 2009 +0530
+++ b/app/projrev/views/proposal.py	Mon Aug 10 01:00:32 2009 +0530
@@ -245,6 +245,7 @@
     cleaned_data = rev_form.cleaned_data
 
     cleaned_data['project'] = Project.objects.get(micr_code=micr_code)
+    cleaned_data['reviewer'] = request.user
 
     # If the form is valid create a new project or update the project
     # if it already exists from the form.
--- a/app/templates/projrev/proposal/review.html	Mon Aug 10 00:40:47 2009 +0530
+++ b/app/templates/projrev/proposal/review.html	Mon Aug 10 01:00:32 2009 +0530
@@ -81,6 +81,10 @@
     {% endif %} 
     </span> 
   </p>
-				
+  {% if reviews %}
+	{% for review in reviews %}
+	  {% as_review review %}
+	{% endfor %}
+	{% endif %}
 </div>
 {% endblock content %}
\ No newline at end of file
--- a/app/templates/projrev/templatetags/_as_comment.html	Mon Aug 10 00:40:47 2009 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-<div class="ghoptaskcomment">
- <div class="title" id="c{{ comment_id }}">
-  On {{ comment.created_on|date:"jS F Y H:i" }},
-  by
-  {% if comment.created_by %} 
-    {{ comment.created_by.name }}:
-  {% else %}
-    {{ site_name }} Automatic Updater:
-  {% endif %}
-  <span class="spc{{ comment_id }}">
-   <a title="Permalink to this Comment" href="#c{{ comment_id }}">¶</a>
-  </span>
- </div>
- <div class="box-inner">
-  <p>
-   {% if comment.content %}
-     {{ comment.content|safe }}</p>
-   {% else %}
-   (No Comment was entered for this change.)
-   {% endif %}
- </div>
- {% if comment.changes %}
-  <div class="changes">
-   <div class="box-inner">
-    <b>Changes:</b>
-    {{ comment.changes|join:"; " }} 
-   </div>
-  </div>
- {% endif %}
-</div>
-<hr />
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/templates/projrev/templatetags/_as_review.html	Mon Aug 10 01:00:32 2009 +0530
@@ -0,0 +1,31 @@
+<div class="ghoptaskcomment">
+ <div class="title" id="c{{ comment_id }}">
+  On {{ comment.created_on|date:"jS F Y H:i" }},
+  by
+  {% if comment.created_by %} 
+    {{ comment.created_by.name }}:
+  {% else %}
+    {{ site_name }} Automatic Updater:
+  {% endif %}
+  <span class="spc{{ comment_id }}">
+   <a title="Permalink to this Comment" href="#c{{ comment_id }}">¶</a>
+  </span>
+ </div>
+ <div class="box-inner">
+  <p>
+   {% if comment.content %}
+     {{ comment.content|safe }}</p>
+   {% else %}
+   (No Comment was entered for this change.)
+   {% endif %}
+ </div>
+ {% if comment.changes %}
+  <div class="changes">
+   <div class="box-inner">
+    <b>Changes:</b>
+    {{ comment.changes|join:"; " }} 
+   </div>
+  </div>
+ {% endif %}
+</div>
+<hr />
\ No newline at end of file