degenhard / django-countries Goto Github PK
View Code? Open in Web Editor NEWA fork of http://bitbucket.org/smileychris/django-countries/ for individual changes and updates.
License: MIT License
A fork of http://bitbucket.org/smileychris/django-countries/ for individual changes and updates.
License: MIT License
================ django-countries ================ A Django application which provides country choices for use with forms, and a country field for models. To use the flags, you will want to copy the flags directory of ``django_countries/media`` to your static files directory, or use the `django-staticfiles`_ application. .. _django-staticfiles: http://pypi.python.org/pypi/django-staticfiles/ CountryField ============ A country field for Django models that provides all ISO 3166-1 countries as choices. ``CountryField`` is based on Django's ``CharField``, providing choices corresponding to the official ISO 3166-1 list of countries (with a default ``max_length`` of 2). Consider the following model using a ``CountryField``:: from django.db import models from django_countries import CountryField class Person(models.Model): name = models.CharField(max_length=100) country = CountryField() Any ``Person`` instance will have a ``country`` attribute that you can use to get details of the person's country: >>> person = Person(name='Chris', country='NZ') >>> person.country Country(code='NZ') >>> person.country.name u'New Zealand' >>> person.country.flag u'/static/flags/nz.gif' This object (``person.country`` in the example) is a ``Country`` instance, which is described below. The ``Country`` object ---------------------- An object used to represent a country, instanciated with a two character country code. It can be compared to other objects as if it was a string containing the country code, and it's ``__unicode__`` method returns the country code. name Contains the full country name. flag Contains a URL to the flag. ``'flags/[lowercasecountrycode].gif'`` is appended to the ``STATIC_URL`` setting, or if that isn't set, the ``MEDIA_URL`` setting. Country Choices =============== The ``django_countries.countries`` module contains some constants which can be used to generate choices lists for a Django ``Select`` form field. ``COUNTRIES`` A tuple of two part tuples, each consisting of a country code and the corresponding nicely titled (and translatable) country name. ``COUNTRIES_PLUS`` A tuple, similar to ``COUNTRIES``, but also includes duplicates for countries that contain a comma (i.e. the non-comma'd version). ``OFFICIAL_COUNTRIES`` A dictionary where each key is a country code and each value is the corresponding official capitalised ISO 3166-1 English country name.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.