Skip to content

Commit

Permalink
Filter "Project extent" from location types (#693)
Browse files Browse the repository at this point in the history
- Fix #598
 - Filter "Project extent" spatial unit type from the location type
   dropdown in the location form.
  • Loading branch information
ian-ross authored and oliverroick committed Sep 15, 2016
1 parent 9ac6de0 commit 27abeed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cadasta/spatial/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from leaflet.forms.widgets import LeafletWidget
from core.util import ID_FIELD_LENGTH
from party.models import Party, TenureRelationship, TenureRelationshipType
from .models import SpatialUnit
from .models import SpatialUnit, TYPE_CHOICES
from .widgets import SelectPartyWidget, NewEntityWidget


Expand All @@ -21,6 +21,9 @@ class LocationForm(AttributeModelForm):
'provided on the left side of the map to mark your '
'new location.')}
)
type = forms.ChoiceField(
choices=filter(lambda c: c[0] != 'PX', TYPE_CHOICES)
)
attributes_field = 'attributes'

class Meta:
Expand Down
1 change: 1 addition & 0 deletions cadasta/spatial/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def test_create_location(self):
form.is_valid()
form.save()

assert all([c[0] != 'PX' for c in form.fields['type'].choices])
assert SpatialUnit.objects.filter(project=project).count() == 1

def test_create_location_with_attributes(self):
Expand Down

0 comments on commit 27abeed

Please sign in to comment.