Repository: ciudadanointeligente/votainteligente-portal-electoral

Issue:
Backend candidato: hay una pregunta que tiene una alternativa en blanco.
![screen shot 2016-09-09 at 15 34 33](https://cloud.githubusercontent.com/assets/1230740/18398356/c5d5be2c-76a2-11e6-8fa6-8268cb436178.png)



Discussion:

Resolving patch:
diff --git a/backend_candidate/views.py b/backend_candidate/views.py
--- a/backend_candidate/views.py
+++ b/backend_candidate/views.py
@@ -38,7 +38,7 @@ def dispatch(self, request, *args, **kwargs):
                                                           **kwargs)
 
 
-class HomeView(BackendCandidateBase, TemplateView):
+class HomeView(BackendCandidateBase, RedirectView):
     template_name = "backend_candidate/home.html"
 
     def get_context_data(self, *args, **kwargs):
@@ -46,6 +46,13 @@ def get_context_data(self, *args, **kwargs):
         context['candidacies'] = self.user.candidacies.all()
         return context
 
+    def get_redirect_url(self, *args, **kwargs):
+        candidacy = self.user.candidacies.first()
+        profile_url = reverse('backend_candidate:complete_profile',
+                              kwargs={'slug': candidacy.candidate.election.slug,
+                                      'candidate_id': candidacy.candidate.id})
+        return profile_url
+
 
 class CompleteMediaNaranjaView(FormView):
     template_name = 'backend_candidate/complete_12_naranja.html'
@@ -106,7 +113,11 @@ def get_redirect_url(self, *args, **kwargs):
         self.contact.candidacy = candidacy
         self.contact.used_by_candidate = True
         self.contact.save()
-        return reverse('backend_candidate:home')
+        candidacy = self.request.user.candidacies.first()
+        profile_url = reverse('backend_candidate:complete_profile',
+                              kwargs={'slug': candidacy.candidate.election.slug,
+                                      'candidate_id': candidacy.candidate.id})
+        return profile_url
 
 
 form_class = get_candidate_profile_form_class()


Test patch:
diff --git a/backend_candidate/tests/candidacy_tests.py b/backend_candidate/tests/candidacy_tests.py
--- a/backend_candidate/tests/candidacy_tests.py
+++ b/backend_candidate/tests/candidacy_tests.py
@@ -70,6 +70,7 @@ def test_instanciate_candidacy(self):
         self.assertTrue(candidacy.created)
         self.assertTrue(candidacy.updated)
 
+
     def test_user_has_candidacy(self):
         self.assertFalse(is_candidate(self.feli))
         candidacy = Candidacy.objects.create(user=self.feli,
@@ -92,12 +93,15 @@ def test_get_candidate_home(self):
                           password='alvarez')
         response = self.client.get(url)
         self.assertEquals(response.status_code, 404)
-        candidacy = Candidacy.objects.create(user=self.feli,
-                                             candidate=self.candidate
-                                             )
+        Candidacy.objects.create(user=self.feli,
+                                 candidate=self.candidate
+                                 )
+
         response = self.client.get(url)
-        self.assertEquals(response.status_code, 200)
-        self.assertIn(candidacy, response.context['candidacies'])
+        profile_url = reverse('backend_candidate:complete_profile',
+                              kwargs={'slug': self.candidate.election.slug,
+                                      'candidate_id': self.candidate.id})
+        self.assertRedirects(response, profile_url)
 
     def test_proposals_with_a_resolution(self):
 
@@ -244,12 +248,14 @@ def test_candidacy_redirect_view(self):
         self.assertRedirects(response, login_url)
         self.client.login(username=self.feli.username, password='alvarez')
         response = self.client.get(url)
-        candidate_home = reverse('backend_candidate:home')
-        self.assertRedirects(response, candidate_home)
-        self.assertTrue(Candidacy.objects.filter(candidate=self.candidate,
-                                                 user=self.feli))
         candidacy = Candidacy.objects.get(candidate=self.candidate,
                                           user=self.feli)
+        profile_url = reverse('backend_candidate:complete_profile',
+                              kwargs={'slug': candidacy.candidate.election.slug,
+                                      'candidate_id': candidacy.candidate.id})
+        self.assertRedirects(response, profile_url)
+        self.assertTrue(Candidacy.objects.filter(candidate=self.candidate,
+                                                 user=self.feli))
         contact = CandidacyContact.objects.get(id=contact.id)
 
         self.assertEquals(contact.candidacy, candidacy)
@@ -364,7 +370,10 @@ def test_login_candidate_marks_her_him_as_contacted(self):
         self.assertRedirects(response, change_password_url)
 
         response = self.client.get(home_url)
-        self.assertEquals(response.status_code, 200)
+        profile_url = reverse('backend_candidate:complete_profile',
+                              kwargs={'slug': contact.candidacy.candidate.election.slug,
+                                      'candidate_id': contact.candidacy.candidate.id})
+        self.assertRedirects(response, profile_url)
 
     @override_settings(MAX_AMOUNT_OF_MAILS_TO_CANDIDATE=3)
     def test_send_candidate_maximum_amount_of_times(self):