May 2016
Beginner to intermediate
446 pages
10h 7m
English
Now that we know which feature the user wants to edit, our next task is to implement the "Edit Feature" page itself. To do this, we are going to have to create a custom form with a single input field, named geometry, that uses a suitable map-editing widget for editing the feature's geometry.
The process of building this form is a bit involved, thanks to the fact that we have to create a new django.contrib.gis.forms.Form subclass on the fly to handle the different types of geometries that can be edited. Let's put this complexity into a new function within the shared.utils module, which we'll call get_map_frm().
Edit the utils.py module and type in the following code:
def get_map_form(shapefile): geometry_field = calc_geometry_field(shapefile.geom_type) ...
Read now
Unlock full access