Open GhalebKhaled opened 2 years ago
@banagale this PR is our solution to Issue 15 -- https://github.com/furious-luke/django-address/issues/15#issuecomment-961482816 -- which we encountered when we migrated back from the dev
branch recently to the main line.
Right now we are monkey patching the library but would prefer that everyone have these options. We have been using this in production for at least a month now without issues. We are using over 20k addresses in production.
This PR tries to solve:
locality
every time even when address is pretty much defined, so we can rely onadministrative_area_level_3
as fallback forcity
value. [Source from google] (https://developers.google.com/maps/documentation/places/web-service/supported_types#table3)state
, such location can't fit in this library, e.g.Copenhagen, Denmark
, proposed solution is to create dummy state to link city and country, i.e.locality
->unknown state
->country
ALLOW_DUMMY_ADDRESSES
toFalse
insetting.py
will stop saving dummy address, in my case, I wanted to raise error you use instead of silently storing dummy datastate_code
with more than8
chars is raising error, user has nothing to do other than selecting same address, so I've changed the handling to trim the extra chars, thestate_code
is invalid from google anyway so I just logged a warning.pyproject.toml
to fixpip install