Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEO_WIDGET_DEFAULT_LOCATION without touching the field returns None #61

Open
marteinn opened this issue May 19, 2020 · 1 comment
Open
Assignees

Comments

@marteinn
Copy link
Member

Expected result would be that GEO_WIDGET_DEFAULT_LOCATION are set.

Description from user:

I just had to manually set the default location, by overriding the save method. I tried to set:GEO_WIDGET_DEFAULT_LOCATION = {'lat': 45.070312, 'lng': 7.6868565}  but when I save the model without touching the location, the location field is set to None (maybe I did something wrong, but with 3 lines of code in the save model I solved the problem).
@marteinn marteinn added the bug label May 19, 2020
@marteinn marteinn self-assigned this Jul 21, 2020
@marteinn
Copy link
Member Author

I tracked this down and this has been the default behavior from the beginning. I can see the use of storing the default value in the field, no matter if map is touched or not. But I can also see the use of having a None value if untouched, as to indicate the map value has not yet been filled. My plan is this:

Current solution

  • GEO_WIDGET_DEFAULT_LOCATION only effect what the map widget should show, but user interaction is required for the value to be saved, If not touched, None are stored.

New behavior

  • GEO_WIDGET_DEFAULT_LOCATION behavior are left unchanged, it only effects the map display.
  • A new setting GEO_WIDGET_SAVE_DEFAULT_LOCATION is introduced to avoid breaking changes, its False by default. Setting it to True will also save the default location as a field value as well.

@marteinn marteinn added enhancement and removed bug labels Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant