We'll next implement the ability to add a new feature. To do this, we'll put an Add Feature button onto the
edit shapefile view. Clicking on this button will call the "edit feature" URL, but without a feature ID. We'll then modify the
edit feature view so that if no feature ID is given a new
Feature object is created.
views.py module, find the
edit_shapefile() function, and add the following highlighted lines to this function:
def editshapefile(request, shapefile_id): try: shapefile = Shapefile.objects.get(id=shapefile_id) except Shapefile.DoesNotExist: raise Http404 tms_url = "http://"+request.get_host()+"/tms/" find_feature_url = "http://" + request.get_host() \ + "/editor/find_feature" add_feature_url ...