def get_items_within_map(request): """ Return a queryset of items within the map location. """ if request.is_ajax(): try: sw_x = float(request.GET.get('sw_x')) sw_y = float(request.GET.get('sw_y')) ne_x = float(request.GET.get('ne_x')) ne_y = float(request.GET.get('ne_y')) except: msg = 'Did not get proper map boundaries' return HttpResponse(simplejson.dumps(dict(message=msg))) # polygon for the search poly_coords = [(sw_x, sw_y), (ne_x, sw_y), (ne_x, ne_y), (sw_x, ne_y), (sw_x, sw_y)] print poly_coords items = search_items_within_poly(poly_coords) return render_to_response('inventory/_list_items.html', {'items': items}, context_instance=RequestContext(request)) else: return HttpResponseBadRequest()
def list(request): """ List the items within the default poly coords. """ # items = search_items_within_poly(DEFAULT_POLY_COORDS) return render_to_response('inventory/general_customer_page.html', { 'items': items, 'center': DEFAULT_CENTER_OBJ }, context_instance=RequestContext(request))