mapOtions + MapWidget

Hello,

django-geoposition is really nice, but I wanted:

- to pass mapOptions to the map
- to reuse my legacy latitude and longitude fields.

At first I try to hack my form to pass the real fields from my model, but that was incompatible with django-reversions, that's why I added the MapWidget you can use both on the same page anyway...

Here is the hack I tried before:

	class CommuneAdminForm(ModelForm):
		map = GeopositionField()
	
		
		class Meta:
			model = Commune
			
		def __init__(self, *args, **kwargs):
			super(CommuneAdminForm,self).__init__(*args, **kwargs)
			# Set the form fields based on the model object
			#self.fields['latitude'].editable = False
			self.initial['map']=[45,0]
			if kwargs.has_key('instance'):
				instance = kwargs['instance']
				self.initial['map'] = [instance.latitude, instance.longitude]
	
		def save(self, commit=True):
			model = super(CommuneAdminForm, self).save(commit=False)
	
			# Save the latitude and longitude based on the form fields
			lat, lon = self.cleaned_data['map']
			model.latitude = float(lat)
			model.longitude = float(lon)
	
			if commit:
				model.save()
	
			return model

And now I can simply write:

	
	class CommuneAdminForm(ModelForm):
	       # latitude = FloatField() -> from model
               # longitude = FloatField() -> from model
               # the map widget is rendered from a dummy field
		map = Field(widget=MapWidget(mapOptions={
				'scrollwheel': False,
			}), required=False)
	
	        # render also a GeopositionWidget
		map2 = GeopositionField(required=False)
	
		class Meta:
			model = Commune