Closed crypto-rizzo closed 2 years ago
About set timezone based on selected location I tested getting the timezone using the lat/long values provided by gmaps api and timezonefinder python package. It seems to work fine.
@crypto-rizzo could you resume what is "Add localized fields as ordered list"?
I added formatted_address to places API, but what we should do with the values? Insert into address_1 and address_2?
@devjoaov Our location schema in the Event
model closely mirrors the Eventbrite API in the pictures attached.
The goal of this issue was to populate the rest of location fields with corresponding Google Maps API data
Thanks @crypto-rizzo.
Hey guys @crypto-rizzo @hubertokf, I want open two discussion for this issue.
It is really make sense store _localized_multi_line_address_display_ values in database? It is just a combination of other fields (adresses, region and etc). I thought about just create a property for Event model called _localized_multi_line_addressdisplay that will works like _fullembed property of Ticket model (beeing just a combination of other fields).
The other discussion is about which package we should use to get timezone lookup based on latitude and longitude values. In first approach, I tested timezonefinder (https://github.com/jannikmi/timezonefinder), a python package that uses Timezone Boundary Builder data. This package works well and is being updated (the last release was 4 days ago) but the performance is not so good. In some tests took 2-3 seconds to find the timezone lookup. Another thing I took into account was how we are saving the localized fields. All the localized fields are being saved in _eventform template. Using the timezonefinder we force that just one field (timezone) is defined into .py code.
I decided search for a timezone lookup javascript lib and I found https://github.com/darkskyapp/tz-lookup-oss/. With it it is possible to import the code in the template and use its methods. This lib also worked fine and is very fast. The problem is that this lib is no longer being updated or maintained for a few years. It solves the problem of to keep the definition of the localized fields in the template.
Resume:
Pros:
Cons:
Pros:
document.getElementById("id_timezone").value = tzlookup(lat, long);
Cons:
Thanks for this @devjoaov. My feedback below:
I agree about both @crypto-rizzo. As there is not a perfect solution for timezone lookup with python or js packages, I will search how to make a good solution with geodjango for timezone lookup.
Leftover from #202
EDIT: OK here is updated list of fields
location
on frontend)Additionally, the
location
field should be replaced withlocalized_address_display