If you want to edit additional attributes besides the geometry (for
example, adding a 'name' to each point), that'd have to be in separate
parts of a form. For example, if your model was like:
class NamedPoint(models.Model):
name = models.CharField(max_length=15)
point = models.PointField()
then you'd have a form that has a field for 'name' and a map widget for
'point'. For example, using a ModelForm:
from olwidget.forms import MapModelForm
class MyForm(MapModelForm):
class Meta:
model = NamedPoint
Or do I misunderstand your question?
best,
Charlie
Ah, I see. That's a bit more complicated. The way I would do that is
create a form that uses a collection of points, and then when you
process the form, create multiple models from that point, for example:
from olwidget.widgets import EditableMap
class Form(forms.Form):
points = forms.CharField(widget=EditableMap({
'geometry': 'point',
'is_collection': True,
}))
.. in the view:
if form.is_valid():
multipoint = form.cleaned_data['points']
for point in multipoint:
... do something ...
This doesn't let you have a different other value (e.g. "name") for each
point though.
-charlie
That's what I thought. I'm going to create a template manually for this page.
thanks Charlie!
Alan