Address formatter for address components from housing
Project description
pik-address-formatter
This project aim is to provide address formatter from address components of housing building
Example:
from address_formatter import all_formats
address_components = {
"region": "Курганская", "region_type_full": "область",
"area": "Катайский", "area_type_full": "район",
"city": "Серов", "city_type_full": "город",
"city_district": "Кировский", "city_district_type_full": "округ",
"settlement": "Дрянное", "settlement_type_full": "село",
"street": "Майская", "street_type_full": "улица",
"house": "5", "house_type_full": "дом",
"section": "6", "building": "7",
}
print(all_formats("plain address ", address_components, "5", 7)['all'])
Курганская обл., Катайский р-н, г. Серов, Кировский окр., с. Дрянное, ул. Майская, д. 5, корп. 6, стр. 7, м. 45
all_formats return dict of address formats
all - full address with region, district, city, township, etc
street_only - street or village
finishing_with_village - region, district, city, township and village
starting_with_street - street, building, section, construction, premise
finishing_with_street - region, district, city, township, village, street
HowToUse
- Add pik-address-formatter to requirements.txt
git+ssh://git@github.com/pik-software/pik-address-formatter.git@v0.1#egg=pik-address-formatter==0.1
- Add address_formats method to target model
from django.db import models
from address_formatter import all_formats
class Account(models.Model):
...
@property
def address_formats(self):
return all_formats(
self.premise.address,
self.building.user_address_components,
self.premise.user_number,
self.building.type,
)
- If you dosn't have a premise model, just use without premise data
from django.db import models
from address_formatter import all_formats
class Account(models.Model):
...
@property
def address_formats(self):
return all_formats(
self.building.address,
self.building.user_address_components,
building_type=self.building.type,
)
- For details see docstring of all_formats
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pik-address-formatter-0.2.tar.gz
.
File metadata
- Download URL: pik-address-formatter-0.2.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
7d870f3c3cd422786d5dffe50d55f6b6939987fa765565f971bf6e0265a3c0e8
|
|
MD5 |
03b1ecadc2d432be92d65ab77be949ec
|
|
BLAKE2b-256 |
34cc2c6fdbcf3d98f61e4b07dd7b65e8161f058c4767ee70c1e1d1c30e08cd49
|
File details
Details for the file pik_address_formatter-0.2-py3-none-any.whl
.
File metadata
- Download URL: pik_address_formatter-0.2-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
c3093d10e1cf53943a631d5d98c4218437ad7363125198fbebc18a58b67a6802
|
|
MD5 |
b8317e186e7ccb1cfa89db7ad5fbbd0a
|
|
BLAKE2b-256 |
31626da2fad5cef5b51b4b0eb4b80759527cc9b6239cbcde3a6ee7f21cc79168
|