Skip to content

django address Model Notes

Rob Banagale edited this page May 20, 2020 · 5 revisions

Address Model

Model Structure and Field Notes

Supports only single length version of route.

  • Consider allowing storage of short and long form of this as per geocoding response from google maps

Does not support neighborhood field.

  • Consider allowing storage of neighborhood, which Mapbox can return

Does not support county or 'administrative_area_level_1'

  • Consider allowing storage of administrative area_level_x

Postal Code-specific Notes

Does not support postal code suffix aka +4

  • A US phenomenon only? References (1, 2)
  • Consider field for storage in Locality

Postal Code Tied to Locality

As noted by @explody here, it may make sense for postal code or a model PostalCode with its own components to be fk'd from Address. For example, google maps treats postal_code as a component of address.

Raw field intention not clear / Model lacks search query that rendered current structrure.

If you've already geocoded an address string into an Address object, you may want to avoid performing the same geocoding operation again on the same query string.

The raw field can be used as a comparison for this purpose, but it isn't clear that this is the intent. Ensure it is, and if so document the use case. Or offer derived_search_query or similar that inbound geocoding requests can be compared to prior to processing / overwriting an Address and its related models unnecessarily.

Need to handle use of geocoder set in different languages

#67 explains that doing so may cause the same country to be represented by multiple objects.

Methods and Functions

Does not offer raw constructor

  • If you set fields on Address and want to generate a new raw from them this assembles it

AddressField Model

Model and Structure Notes

Uses ForeignKey to Address

  • This does not appear to be the correct way to declare a custom model field. Originally pointed out in #49.

Scaling problems

Possibly blamed for problems migrating scaled django site Listen at 35:24