You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello there. I have a strange behaviour with the LocationField in my forms.py.
I guess i do something wrong, but have no idea what it is (maybe the problem is that i use crispy-forms?)
I have a Spatial LocationField in my model and added it also to my Create-Form.
When LocationField.clean() is called, the value is always None, which leads to a AttributeError.
The initial-value gets propagated to self.initial in my case.
classLocationField(PlainLocationField):
defclean(self, value):
try:
lat, lng=value.split(',')
returnPoint(float(lng), float(lat))
exceptValueError:
returnNone
So as a workaround i created a costum MyLocationField() where i add the initial value directly into the .clean() function.
I am looking forward to any kind of help or advice here. Thank you!
The text was updated successfully, but these errors were encountered:
Hello there. I have a strange behaviour with the
LocationField
in myforms.py
.I guess i do something wrong, but have no idea what it is (maybe the problem is that i use crispy-forms?)
I have a Spatial
LocationField
in my model and added it also to my Create-Form.forms.py
Problem:
When
LocationField.clean()
is called, the value is alwaysNone
, which leads to aAttributeError
.The initial-value gets propagated to
self.initial
in my case.So as a workaround i created a costum
MyLocationField()
where i add the initial value directly into the.clean()
function.I am looking forward to any kind of help or advice here. Thank you!
The text was updated successfully, but these errors were encountered: