Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter "Project extent" from location types #693

Merged
merged 1 commit into from
Sep 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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