diff --git a/cadasta/xforms/mixins/model_helper.py b/cadasta/xforms/mixins/model_helper.py
index 3d1dd5515..3270198e0 100644
--- a/cadasta/xforms/mixins/model_helper.py
+++ b/cadasta/xforms/mixins/model_helper.py
@@ -7,7 +7,7 @@
from django.utils.translation import ugettext as _
from party.models import Party, TenureRelationship, TenureRelationshipType
from pyxform.xform2json import XFormToDict
-from questionnaires.models import Questionnaire
+from questionnaires.models import Questionnaire, Question
from resources.models import Resource
from spatial.models import SpatialUnit
from xforms.exceptions import InvalidXMLSubmission
@@ -75,7 +75,8 @@ def create_spatial_unit(self, data, project, questionnaire, party=None):
geoshape = True
else:
location_geometry = data['location_geometry']
- geoshape = False
+ geoshape = Question.objects.filter(
+ questionnaire=questionnaire, type='GS').exists()
try:
location = SpatialUnit.objects.create(
project=project,
diff --git a/cadasta/xforms/tests/files/test_resources.py b/cadasta/xforms/tests/files/test_resources.py
index e7a05c58e..81dc161da 100644
--- a/cadasta/xforms/tests/files/test_resources.py
+++ b/cadasta/xforms/tests/files/test_resources.py
@@ -174,6 +174,33 @@
'''.strip()
+NEITHER_FORM = '''
+
+ 2016-07-07T16:38:20.310-04
+ 2016-07-07T16:39:23.673-04
+ 2016-07-07
+ 00:bb:3a:44:d0:fb
+
+ IN
+ Natashia Romanoff
+ neither
+ 45.56342779158167 -122.67650283873081 0.0 0.0;
+ 45.56176327330353 -122.67669159919024 0.0 0.0;
+ 45.56151562182025 -122.67490658909082 0.0 0.0;
+ 45.563479432877415 -122.67494414001703 0.0 0.0;
+ 45.56176327330353 -122.67669159919024 0.0 0.0
+
+ MI
+ LH
+
+ Geoshape
+
+
+ uuid:b3f225d3-0fac-4a0b-80c7-60e6db4cc0ad
+
+ '''.strip()
+
BAD_QUESTIONNAIRE = '''
2016-07-07T16:38:20.310-04
@@ -273,6 +300,7 @@
'poly_form': POLY_FORM,
'missing_semi_form': MISSING_SEMI_FORM,
'geoshape_form': GEOSHAPE_FORM,
+ 'location_geoshape_form': NEITHER_FORM,
'bad_questionnaire': BAD_QUESTIONNAIRE,
'bad_location_form': BAD_LOCATION_FORM,
'bad_party_form': BAD_PARTY_FORM,
diff --git a/cadasta/xforms/tests/test_views_api.py b/cadasta/xforms/tests/test_views_api.py
index 3a1debb40..0dec2680a 100644
--- a/cadasta/xforms/tests/test_views_api.py
+++ b/cadasta/xforms/tests/test_views_api.py
@@ -328,6 +328,15 @@ def test_geoshape_upload(self):
assert response.status_code == 201
assert geom.geometry.geom_type == 'Polygon'
+ def test_geoshape_as_location_geometry_upload(self):
+ data = self._submission(form='location_geoshape_form')
+ response = self.request(method='POST', user=self.user, post_data=data,
+ content_type='multipart/form-data')
+
+ geom = SpatialUnit.objects.get(attributes={'name': 'Geoshape'})
+ assert response.status_code == 201
+ assert geom.geometry.geom_type == 'Polygon'
+
def test_invalid_submission_upload(self):
# testing submitting with a missing xml_submission_file
data = self._invalid_submission(form='This is not an xml form!')