Skip to main content

pypi version license build status

django abstract model that provide the complete address, eg: no, na/rt, ca/rw, village, sub district, district, province, country, postal code, currency code, phone code, etc.

https://i.imgur.com/5mV5Jje.png

Support Languages

  1. ID - Indonesia

Quick start

  1. Django Log Viewer is available directly from PyPI:

pip install django-address-model
  1. Add "django_address" to your INSTALLED_APPS setting like this

INSTALLED_APPS = [
    ...
    "django_address",
]
  1. Create an initial address

python manage.py create_address --language=id --show-print=true

Usage Example

In your models.py

from django.db import models
from django_address.models import AddressModel


class Profile(AddressModel, models.Model):
    name = models.CharField(max_length=100)
    email = models.EmailField(blank=True, null=True)
    phone = models.CharField(max_length=15, blank=True, null=True)

    def __str__(self):
        return self.name

    class Meta:
        ordering = ('-id',)

ORM Usage Example

>>> from django_address.models import SubDistrict
>>> from app.models import Profile
>>>
>>> sub_district = SubDistrict.objects.first()
>>> profile_data {'name': 'Summon Agus', 'email': 'summon@mail.com', 'phone': '+6282133338888',
                  'address': 'Jl. Karto Dimejo', 'number': 35, 'na': 3, 'ca': 34, 'village': 'Sinduarjo',
                  'sub_district': sub_district}
>>> profile = Profile.objects.create(**profile_data)
>>> profile.number
35
>>> profile.address
'Jl. Karto Dimejo'
>>> profile.village
'Sinduarjo'
>>> profile.sub_district
'Ngaglik'
>>> profile.sub_district.district
'Sleman'
>>> profile.get_full_address(format_address='id', include_country=True)
'Jl. Karto Dimejo No.35, RT.3/RW.34 Sinduarjo, Ngaglik, Sleman, Yogyakarta, Indonesia - 55581'
>>>
>>> profile.get_full_address_json()
{
  'na': 3,
  'ca': 34,
  'number': 35,
  'village': 'Sinduarjo',
  'address': 'Jl. Karto Dimejo',
  'sub_district': {
    'id': 1,
    'district': 1,
    'deleted_at': None,
    'postal_code': '55581',
    'name': 'Ngaglik'
  },
  'district': {
    'id': 1,
    'name': 'Sleman',
    'deleted_at': None,
    'province': 1
  },
  'province': {
    'id': 1,
    'name': 'Yogyakarta',
    'deleted_at': None,
    'country': 1
  },
  'country': {
    'id': 1,
    'phone_code': '+62',
    'deleted_at': None,
    'name': 'Indonesia',
    'currency_code': 'IDR',
    'code': 'ID',
    'states': [
      'Aceh',
      'Bali',
      'Banten',
      'Bengkulu',
      'Gorontalo',
      'Jakarta',
      'Jambi',
      'Jawa Barat',
      'Jawa Tengah',
      'Jawa Timur',
      'Kalimantan Barat',
      'Kalimantan Selatan',
      'Kalimantan Tengah',
      'Kalimantan Timur',
      'Kalimantan Utara',
      'Kepulauan Bangka Belitung',
      'Kepulauan Riau',
      'Lampung',
      'Maluku',
      'Maluku Utara',
      'Nusa Tengga     ra Barat',
      'Nusa Tenggara Timur',
      'Papua (Irian Jaya)',
      'Papua Barat',
      'Riau',
      'Sulawesi Barat',
      'Sulawesi Selatan',
      'Sulawesi Tengah',
      'Sulawesi Tenggara',
      'Sulawesi Utara',
      'Sumatera Barat',
      'Sumatera Selatan',
      'Sumatera Utara',
      'Yogyakarta'
    ]
  }
}
>>>

Metadata

Release files for django-address-model 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-address-model 1.0.4
File Size Uploaded Provenance
django-address-model-1.0.4.tar.gz 919.2 kB Without provenance Details

Release files / django-address-model-1.0.4.tar.gz

Download URL django-address-model-1.0.4.tar.gz
Size 919.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a7486aff2cbdd190bd212635db0827fdab6f046ebdef1f78a5e1eedb27c22882
BLAKE2b-256 checksum
How to use checksums
194946de7122881f68e0419b30f03daa7372ba4955d1f8e1b2e233b39b0b4aa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

Security for django-address-model 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page