Countries for django
Project description
Django Country Kit
Django Country Kit is a Django app that provides country-related functionality, including a custom model field for storing country codes, a form widget for selecting countries, and associated tests.
Features
- Country Model Field: Easily store and retrieve country codes in your Django models.
- Country Widget: A form widget for rendering a dropdown list of countries in your Django forms.
- Tested: Comprehensive tests for ensuring the functionality of the provided components.
Installation
-
Install Django Country Kit using pip:
pip install django-country-kit
-
Add
'django_country_kit'
to yourINSTALLED_APPS
in your Django project's settings:INSTALLED_APPS = [ # ... 'django_country_kit', # ... ]
-
Run migrations to create the necessary database tables:
python manage.py migrate
-
Run collectstatic:
python manage.py collectstatic
Usage
Country Model Field
In your models, use the CountryField
to store country codes:
from django.db import models
from django_country_kit.fields import CountryField
class YourModel(models.Model):
country = CountryField()
Country Widget
In your forms, use the CountryWidget
to render a dropdown list of countries:
from django import forms
from django_country_kit.widgets import CountryWidget
class YourForm(forms.Form):
country = forms.CharField(widget=CountryWidget())
Custom settings
Django Country Kit provides custom settings for further customization of country data:
OVERRIDE_COUNTRIES
: Allows users to override specific countries with custom data.EXCLUDE_COUNTRIES
: Allows users to exclude specific countries from the available choices.
You can customize these settings in your Django project's settings file to tailor the country data according to your needs.
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
Hashes for django_country_kit-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85585ec4a4df7dcb0255da5450a5e5b797732fb37f82c769708204d46187a1f8 |
|
MD5 | a042e6ab77b8c77d151b754a6e0d003d |
|
BLAKE2b-256 | b4bbebc57d1a9ceb17e06254b9dca8882a7cfdd176a43e5acb16220e0bda4286 |