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
pik-address-formatter>=1.0,<2.0
- 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
Metadata
Release files for pik-address-formatter 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pik-address-formatter-1.1.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pik_address_formatter-1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.0 kB
Release files / pik-address-formatter-1.1.tar.gz
| Download URL | pik-address-formatter-1.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
875b64aa2a4e1a5333faa2b987dd6cf2fc137baf35486a1bf230c9de170f66ab
|
|
BLAKE2b-256 checksum How to use checksums |
c44f1fd634f7d9fddcfbf5daa9f3a1e82485a99ebd534efd242b01541c2f0a1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6
|
Release files / pik_address_formatter-1.1-py3-none-any.whl
| Download URL | pik_address_formatter-1.1-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6da50a5a1459f69c4e2ce966c708a8de7aa9e6589f363fe43d5723b5ecefb763
|
|
BLAKE2b-256 checksum How to use checksums |
b94335327734fb88060fc9be86e594e1d8a5d87770afa964c60660f866f87643
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6
|