Repository: ciudadanointeligente/votainteligente-portal-electoral

Issue:
Comentarios sobre la revisión
Un usuario puede agregar comentarios sobre su revisión



Discussion:

Resolving patch:
diff --git a/popular_proposal/forms.py b/popular_proposal/forms.py
--- a/popular_proposal/forms.py
+++ b/popular_proposal/forms.py
@@ -128,6 +128,9 @@ def reject(self):
 
 
 class ProposalTemporaryDataUpdateForm(ProposalFormBase):
+    overall_comments = forms.CharField(required=False, label=_(u'Comentarios sobre tu revisón'))
+    
+    
     def __init__(self, *args, **kwargs):
         self.proposer = kwargs.pop('proposer')
         self.temporary_data = kwargs.pop('temporary_data')
@@ -139,11 +142,15 @@ def __init__(self, *args, **kwargs):
                 self.fields[comment_key].help_text += _(' <b>Commentarios: %s </b>') % (comment)
 
     def save(self):
+        self.overall_comments = self.cleaned_data.pop('overall_comments')
         self.temporary_data.data = self.cleaned_data
+        self.temporary_data.overall_comments = self.overall_comments
         self.temporary_data.status = ProposalTemporaryData.Statuses.InOurSide
         self.temporary_data.save()
         return self.temporary_data
-
+    
+    def get_overall_comments(self):
+        return self.cleaned_data.get('overall_comments', '')
 
 class SubscriptionForm(forms.Form):
     def __init__(self, *args, **kwargs):
diff --git a/popular_proposal/migrations/0008_proposaltemporarydata_overall_comments.py b/popular_proposal/migrations/0008_proposaltemporarydata_overall_comments.py
new file mode 100644
--- /dev/null
+++ b/popular_proposal/migrations/0008_proposaltemporarydata_overall_comments.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.2 on 2016-04-18 19:04
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('popular_proposal', '0007_popularproposal_likers'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='proposaltemporarydata',
+            name='overall_comments',
+            field=models.CharField(blank=True, default='', max_length=512, null=True),
+        ),
+    ]
diff --git a/popular_proposal/models.py b/popular_proposal/models.py
--- a/popular_proposal/models.py
+++ b/popular_proposal/models.py
@@ -39,6 +39,10 @@ class Statuses(DjangoChoices):
                               choices=Statuses.choices,
                               validators=[Statuses.validator],
                               default=Statuses.InOurSide)
+    overall_comments = models.CharField(max_length=512,
+                                        blank=True,
+                                        null=True,
+                                        default="")
 
     needing_moderation = NeedingModerationManager()
     objects = models.Manager()


Test patch:
diff --git a/popular_proposal/tests/__init__.py b/popular_proposal/tests/__init__.py
--- a/popular_proposal/tests/__init__.py
+++ b/popular_proposal/tests/__init__.py
@@ -25,6 +25,7 @@ def setUp(self):
             'solution': '',
             'when': u'El plazo no está tan bueno',
             'allies': ''
+            
         }
 
 
diff --git a/popular_proposal/tests/form_tests.py b/popular_proposal/tests/form_tests.py
--- a/popular_proposal/tests/form_tests.py
+++ b/popular_proposal/tests/form_tests.py
@@ -147,16 +147,20 @@ def test_update_temporary_popular_proposal(self):
         #}
         data = self.data
         data['solution'] = u'Viajar a ver al equipo una vez al mes'
+        data['overall_comments'] = u"Quizás sea una buena idea que revises si conviene el plazo de un año"
         form = ProposalTemporaryDataUpdateForm(data=data,
                                                temporary_data=temporary_data,
                                                proposer=self.fiera)
         self.assertTrue(form.initial)
         self.assertIn(self.comments['when'], form.fields['when'].help_text)
         self.assertTrue(form.is_valid())
+        self.assertEquals(form.get_overall_comments(), data['overall_comments'])
         temporary_data = form.save()
         temporary_data = ProposalTemporaryData.objects.get(id=temporary_data.id)
+        overall_comments = data.pop('overall_comments')
         self.assertEquals(temporary_data.data, data)
         self.assertEquals(temporary_data.status, ProposalTemporaryData.Statuses.InOurSide)
+        self.assertEquals(temporary_data.overall_comments, overall_comments)
 
     def test_when_template_tag(self):
         choice = WHEN_CHOICES[0]
diff --git a/popular_proposal/tests/new_proposal_cycle_tests.py b/popular_proposal/tests/new_proposal_cycle_tests.py
--- a/popular_proposal/tests/new_proposal_cycle_tests.py
+++ b/popular_proposal/tests/new_proposal_cycle_tests.py
@@ -25,6 +25,7 @@ def test_instanciate_one(self):
         self.assertIsNotNone(temporary_data.comments['solution'])
         self.assertIsNotNone(temporary_data.comments['when'])
         self.assertIsNotNone(temporary_data.comments['allies'])
+        self.assertIsNotNone(temporary_data.overall_comments)
         self.assertEquals(temporary_data.status, ProposalTemporaryData.Statuses.InOurSide)
         self.assertIn(temporary_data, self.fiera.temporary_proposals.all())
         self.assertEquals(temporary_data.get_title(), self.data['title'])