Merge branch 'master' of https://code.google.com/p/soc
diff --git a/app/soc/modules/gci/views/document.py b/app/soc/modules/gci/views/document.py
index e2d38a9..a923d1a 100644
--- a/app/soc/modules/gci/views/document.py
+++ b/app/soc/modules/gci/views/document.py
@@ -30,7 +30,7 @@
 class GCIDocumentForm(forms.GCIModelForm, document.DocumentForm):
   """Django form for creating documents."""
 
-  dashboard_visibility = forms.MultipleChoiceField(
+  dashboard_visibility = forms.MultipleChoiceField(required=False,
       choices=[(v, v) for v in document_model.Document.VISIBILITY],
       widget=forms.CheckboxSelectMultiple)
 
diff --git a/app/soc/views/document.py b/app/soc/views/document.py
index d85222d..3d847c6 100644
--- a/app/soc/views/document.py
+++ b/app/soc/views/document.py
@@ -25,7 +25,7 @@
 class DocumentForm(forms.ModelForm):
   """Django form for creating documents."""
 
-  dashboard_visibility = forms.MultipleChoiceField(
+  dashboard_visibility = forms.MultipleChoiceField(required=False,
       choices=[(v, v) for v in document_model.Document.VISIBILITY],
       widget=forms.CheckboxSelectMultiple)
 
diff --git a/tests/app/soc/modules/gci/views/test_document.py b/tests/app/soc/modules/gci/views/test_document.py
index 80a5382..6e7cba9 100644
--- a/tests/app/soc/modules/gci/views/test_document.py
+++ b/tests/app/soc/modules/gci/views/test_document.py
@@ -73,7 +73,7 @@
     # TODO(SRabbelier): test document ACL
     pass
 
-  def testCreateDocument(self):
+  def testCreateDocumentWithDashboardVisibility(self):
     self.data.createHost()
     url = '/gci/document/edit/gci_program/%s/doc' % self.gci.key().name()
     response = self.get(url)
@@ -96,3 +96,27 @@
     key_name = properties['key_name']
     document = Document.get_by_key_name(key_name)
     self.assertPropertiesEqual(properties, document)
+
+  def testCreateDocumentWithDashboardVisibility(self):
+    self.data.createHost()
+    url = '/gci/document/edit/gci_program/%s/doc' % self.gci.key().name()
+    response = self.get(url)
+    self.assertGCITemplatesUsed(response)
+    self.assertTemplateUsed(response, 'v2/modules/gci/document/base.html')
+    self.assertTemplateUsed(response, 'v2/modules/gci/_form.html')
+
+    # test POST
+    override = {
+        'prefix': 'gci_program', 'scope': self.gci, 'link_id': 'doc',
+        'key_name': DocumentKeyNameProvider(), 'modified_by': self.data.user,
+        'home_for': None, 'author': self.data.user, 'is_featured': None,
+        'write_access': 'admin', 'read_access': 'public',
+        'dashboard_visibility': [],
+    }
+    properties = seeder_logic.seed_properties(Document, properties=override)
+    response = self.post(url, properties)
+    self.assertResponseRedirect(response, url)
+
+    key_name = properties['key_name']
+    document = Document.get_by_key_name(key_name)
+    self.assertPropertiesEqual(properties, document)
diff --git a/tests/app/soc/modules/gsoc/views/test_document.py b/tests/app/soc/modules/gsoc/views/test_document.py
index 09086aa..e8fd412 100644
--- a/tests/app/soc/modules/gsoc/views/test_document.py
+++ b/tests/app/soc/modules/gsoc/views/test_document.py
@@ -58,7 +58,7 @@
     # TODO(SRabbelier): test document ACL
     pass
 
-  def testCreateDocument(self):
+  def testCreateDocumentWithDashboardVisibility(self):
     self.data.createHost()
     url = '/gsoc/document/edit/gsoc_program/%s/doc' % self.gsoc.key().name()
     response = self.get(url)
@@ -82,6 +82,30 @@
     document = Document.get_by_key_name(key_name)
     self.assertPropertiesEqual(properties, document)
 
+  def testCreateDocumentNoDashboardVisibility(self):
+    self.data.createHost()
+    url = '/gsoc/document/edit/gsoc_program/%s/doc' % self.gsoc.key().name()
+    response = self.get(url)
+    self.assertGSoCTemplatesUsed(response)
+    self.assertTemplateUsed(response, 'v2/modules/gsoc/document/base.html')
+    self.assertTemplateUsed(response, 'v2/modules/gsoc/_form.html')
+
+    # test POST
+    override = {
+        'prefix': 'gsoc_program', 'scope': self.gsoc, 'link_id': 'doc',
+        'key_name': DocumentKeyNameProvider(), 'modified_by': self.data.user,
+        'home_for': None, 'author': self.data.user, 'is_featured': None,
+        'write_access': 'admin', 'read_access': 'public',
+        'dashboard_visibility': [],
+    }
+    properties = seeder_logic.seed_properties(Document, properties=override)
+    response = self.post(url, properties)
+    self.assertResponseRedirect(response, url)
+
+    key_name = properties['key_name']
+    document = Document.get_by_key_name(key_name)
+    self.assertPropertiesEqual(properties, document)
+
 
 # TODO(nathaniel): More than just a simple smoke test.
 class EventsPageTest(GSoCDjangoTestCase):