Repository: kartoza/prj.app

Issue:
No way to make a team
We need the same create etc paradigm as versions has for teams:

<img width="1357" alt="screen shot 2016-06-22 at 00 05 21" src="https://cloud.githubusercontent.com/assets/178003/16248033/153238c6-380d-11e6-9f73-26d2849edbfb.png">

Should look like a variation of this with a project logo, list of teams and create etc tools for teams:

<img width="1202" alt="screen shot 2016-06-22 at 00 05 59" src="https://cloud.githubusercontent.com/assets/178003/16248065/389ff410-380d-11e6-9722-7bef9dbfd43f.png">



Discussion:

Resolving patch:
diff --git a/django_project/vota/forms.py b/django_project/vota/forms.py
--- a/django_project/vota/forms.py
+++ b/django_project/vota/forms.py
@@ -54,7 +54,7 @@ class Meta:
     def __init__(self, *args, **kwargs):
         self.user = kwargs.pop('user')
         self.project = kwargs.pop('project')
-        form_title = 'New Committee for %s' % self.project.name
+        form_title = 'New Team for %s' % self.project.name
         self.helper = FormHelper()
         layout = Layout(
             Fieldset(
@@ -79,10 +79,11 @@ def __init__(self, *args, **kwargs):
             .order_by('username')
 
     def save(self, commit=True):
-        instance = super(CreateCommitteeForm, self).save(commit=False)
-        instance.chair = self.user
+        form = super(CreateCommitteeForm, self)
+        instance = form.save(commit=False)
         instance.project = self.project
         instance.save()
+        form.save()
         return instance
 
 
diff --git a/django_project/vota/views/committee.py b/django_project/vota/views/committee.py
--- a/django_project/vota/views/committee.py
+++ b/django_project/vota/views/committee.py
@@ -101,6 +101,24 @@ class CommitteeListView(CommitteeMixin, ListView):
     context_object_name = 'committees'
     template_name = 'committee/list.html'
 
+    def get_context_data(self, **kwargs):
+        """Get the context data which is passed to a template.
+
+        :param kwargs: Any arguments to pass to the superclass.
+        :type kwargs: dict
+
+        :returns: Context data which will be passed to the template.
+        :rtype: dict
+        """
+        context = super(CommitteeListView, self).get_context_data(**kwargs)
+        context['num_committees'] = self.get_queryset().count()
+        context['unapproved'] = False
+        project_slug = self.kwargs.get('project_slug', None)
+        context['project_slug'] = project_slug
+        if project_slug:
+            context['the_project'] = Project.objects.get(slug=project_slug)
+        return context
+
     def get(self, request, *args, **kwargs):
         """Access URL parameters
 
@@ -160,9 +178,8 @@ def get_form_kwargs(self):
         return kwargs
 
     def get_success_url(self):
-        return reverse('committee-detail', kwargs={
-            'project_slug': self.object.project.slug,
-            'slug': self.object.slug
+        return reverse('committee-list', kwargs={
+            'project_slug': self.object.project.slug
         })
 
     def form_valid(self, form):


Test patch:
diff --git a/django_project/vota/tests/test_views.py b/django_project/vota/tests/test_views.py
--- a/django_project/vota/tests/test_views.py
+++ b/django_project/vota/tests/test_views.py
@@ -385,9 +385,8 @@ def test_CommitteeCreate_with_login(self):
         response = client.post(reverse('committee-create', kwargs={
             'project_slug': self.project.slug
         }), post_data)
-        self.assertRedirects(response, reverse('committee-detail', kwargs={
-            'project_slug': self.project.slug,
-            'slug': 'new-test-committee'
+        self.assertRedirects(response, reverse('committee-list', kwargs={
+            'project_slug': self.project.slug
         }))
 
     def test_CommitteeCreate_no_login(self):