Improved location widget
This commit is contained in:
@@ -4,8 +4,8 @@ from location_field import forms
|
||||
|
||||
|
||||
class BaseLocationField(object):
|
||||
def __init__(self, based_fields=[], zoom=2, default=None, *args, **kwargs):
|
||||
self._based_fields = based_fields
|
||||
def __init__(self, based_field=None, zoom=2, default=None, *args, **kwargs):
|
||||
self._based_field = based_field
|
||||
self._zoom = zoom
|
||||
self._default = default
|
||||
self.default = default
|
||||
@@ -13,7 +13,7 @@ class BaseLocationField(object):
|
||||
def formfield(self, **kwargs):
|
||||
return super(BaseLocationField, self).formfield(
|
||||
form_class=self.formfield_class,
|
||||
based_fields=self._based_fields,
|
||||
based_field=self._based_field,
|
||||
zoom=self._zoom,
|
||||
default=self._default,
|
||||
**kwargs)
|
||||
@@ -22,10 +22,10 @@ class BaseLocationField(object):
|
||||
class PlainLocationField(BaseLocationField, CharField):
|
||||
formfield_class = forms.PlainLocationField
|
||||
|
||||
def __init__(self, based_fields=None, zoom=None,
|
||||
def __init__(self, based_field=None, zoom=None,
|
||||
max_length=63, *args, **kwargs):
|
||||
|
||||
super(PlainLocationField, self).__init__(based_fields=based_fields,
|
||||
super(PlainLocationField, self).__init__(based_field=based_field,
|
||||
zoom=zoom, *args, **kwargs)
|
||||
|
||||
CharField.__init__(self, max_length=max_length, *args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user