changes in next previous
This commit is contained in:
commit
c36f2bc298
|
@ -24,8 +24,8 @@ class FeatureSearchManager(models.GeoManager):
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
cursor.execute("""SELECT set_limit(%f)""" % threshold)
|
cursor.execute("""SELECT set_limit(%f)""" % threshold)
|
||||||
|
|
||||||
def find(self, bbox=None, text=None, adm1=None, adm2=None, threshold=0.5, srid=4326):
|
def find(self, bbox=None, text=None, adm1=None, adm2=None, is_primary=True, threshold=0.5, srid=4326):
|
||||||
qset = self.get_query_set()
|
qset = self.get_query_set().filter(is_primary=is_primary)
|
||||||
if bbox:
|
if bbox:
|
||||||
(minx, miny, maxx, maxy) = bbox
|
(minx, miny, maxx, maxy) = bbox
|
||||||
bbox = Polygon(((minx,miny),(minx,maxy),(maxx,maxy),(maxx,miny),(minx,miny)),srid=srid)
|
bbox = Polygon(((minx,miny),(minx,maxy),(maxx,maxy),(maxx,miny),(minx,miny)),srid=srid)
|
||||||
|
|
|
@ -65,11 +65,11 @@ def search_related_json(request, id):
|
||||||
d = []
|
d = []
|
||||||
|
|
||||||
for s in similar_features:
|
for s in similar_features:
|
||||||
time_frame = relates_to = related_by = ""
|
time_frame = relates_to = related_by = ""
|
||||||
if s.time_frame is not None:
|
if s.time_frame is not None:
|
||||||
time_frame = s.time_frame.description
|
time_frame = s.time_frame.description
|
||||||
if s.relationship_type is not None:
|
if s.relationship_type is not None:
|
||||||
if s.feature2_id == s.id:
|
if s.feature2_id == s.id:
|
||||||
relates_to = s.relationship_type
|
relates_to = s.relationship_type
|
||||||
elif s.feature1_id == s.id:
|
elif s.feature1_id == s.id:
|
||||||
related_by = s.relationship_type
|
related_by = s.relationship_type
|
||||||
|
@ -82,7 +82,7 @@ def search_related_json(request, id):
|
||||||
'time_frame': time_frame,
|
'time_frame': time_frame,
|
||||||
'is_primary': s.is_primary,
|
'is_primary': s.is_primary,
|
||||||
'relates_to': relates_to,
|
'relates_to': relates_to,
|
||||||
'related_by': related_by
|
'related_by': related_by
|
||||||
})
|
})
|
||||||
return render_to_json_response(d)
|
return render_to_json_response(d)
|
||||||
|
|
||||||
|
@ -120,19 +120,22 @@ def add_relation(request):
|
||||||
feature2 = get_object_or_404_json(Feature, pk=feature2)
|
feature2 = get_object_or_404_json(Feature, pk=feature2)
|
||||||
rel_obj = None
|
rel_obj = None
|
||||||
try:
|
try:
|
||||||
rel_obj = Relationship.objects.get(feature1=feature1, feature2=feature2, relationship_type=relation)
|
rel_obj = Relationship.objects.get(feature1=feature1, feature2=feature2, relationship_type=relation)
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
rel_obj = Relationship(feature1=feature1, feature2=feature2, relationship_type=relation)
|
rel_obj = Relationship(feature1=feature1, feature2=feature2, relationship_type=relation)
|
||||||
verb = "created"
|
verb = "created"
|
||||||
if relation == "":
|
if relation == "":
|
||||||
if rel_obj.id:
|
if rel_obj.id:
|
||||||
verb = "deleted"
|
verb = "deleted"
|
||||||
rel_obj.delete()
|
rel_obj.delete()
|
||||||
else:
|
if relation == "conflates":
|
||||||
|
feature2.is_primary = True
|
||||||
|
feature2.save()
|
||||||
|
else:
|
||||||
return render_to_json_response({'error': 'relation is already deleted'})
|
return render_to_json_response({'error': 'relation is already deleted'})
|
||||||
else:
|
else:
|
||||||
rel_obj.save()
|
rel_obj.save()
|
||||||
if relation == "subsumes":
|
if relation == "conflates":
|
||||||
feature2.is_primary = False
|
feature2.is_primary = False
|
||||||
feature2.save()
|
feature2.save()
|
||||||
return render_to_json_response({'success': 'relation %s successfully.' % verb})
|
return render_to_json_response({'success': 'relation %s successfully.' % verb})
|
||||||
|
|
|
@ -210,10 +210,10 @@ font-size:10px;}
|
||||||
{-moz-box-shadow:2px 3px 4px #c6c0c0;
|
{-moz-box-shadow:2px 3px 4px #c6c0c0;
|
||||||
-webkit-box-shadow:2px 3px 4px #c6c0c0;
|
-webkit-box-shadow:2px 3px 4px #c6c0c0;
|
||||||
box-shadow:2px 3px 4px #c6c0c0;
|
box-shadow:2px 3px 4px #c6c0c0;
|
||||||
-moz-transform:scale(1.25);
|
/*-moz-transform:scale(1.25);
|
||||||
-webkit-transform:scale(1.25);
|
-webkit-transform:scale(1.25);
|
||||||
-o-transform:scale(1.25);
|
-o-transform:scale(1.25);
|
||||||
transform:scale(1.25);}
|
transform:scale(1.25);}*/
|
||||||
|
|
||||||
/*.paginateSelected li*/ /*do i need to repeat all these classes from the .paginate div ?, also do the same for first child and last child please*/
|
/*.paginateSelected li*/ /*do i need to repeat all these classes from the .paginate div ?, also do the same for first child and last child please*/
|
||||||
/*{float:left;
|
/*{float:left;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user