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

Django integration? #17

Open
moul opened this issue Feb 22, 2017 · 2 comments
Open

Django integration? #17

moul opened this issue Feb 22, 2017 · 2 comments

Comments

@moul
Copy link

moul commented Feb 22, 2017

Hi @kdeldycke and @scaleway,

Do you think we could use this library to create a Django PostalAddressField?
Could you write some documentation, snippet or maybe a library for this?

@kdeldycke
Copy link
Contributor

Sorry @moul, never wrote a single line of code within the Django ecosystem so I can't really help you there. That being said, I'll welcome any contribution to work toward that goal.

As of integrating the Django boilerplate code directly in this repository, it depends on its nature. If it's lightweight and doesn't prevent usage of postal-address as a stand-alone Python module, why not. Else, it might be better to create a side project to wrap postal-address and provide a proper Django field.

@shaleh
Copy link

shaleh commented Sep 17, 2019

A Field is likely not what you want. Fields map to a column in a database. I suspect most people don't want their normalized addresses stuffed into a database as a string.

A more sensible approach would be to make a Django package that wraps this package and supplied a PostalAddress model. Then the individual parts of the address would be represented as independent fields in a table. Now someone could select distinct(country_code) from postal_address or in Django ORM french_connections = PostalAddress.objects.filter(country_count='FR').count().

What anyone interested would need to do is make a django-postal-address package and add a PostalAddress and Territory model. These would look a lot like the objects in this package with additions like date_created. Add a method to the models to create one from the PostalAddress or Territory object and to create a PostalAddress or Territory from the models.

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

3 participants