Additional functions of “local characteristics”
Due to historical factors, Django brought his own
django.contrib.localflavor–A variety of code snippets that can be used in a particular country, region, or culture. To facilitate maintenance and reduce the size of the Django code base, the code is now released separately from Django.
See the official document for details:
The code is hosted on GitHub,https://github.com/django/django-localflavor。
How to migrate
If you use the old version of
django-localflavor-*Follow these two simple steps to update your code
Installing third party’s in pypi
Modify the import statement you apply to reference the new package.
from django.contrib.localflavor.fr.forms import FRPhoneNumberField
... to read:
from localflavor.fr.forms import FRPhoneNumberField
The code in the new package is the same as before (it’s copied directly from Django), so you don’t have to worry about backward compatibility. Just modify the import statement.
In Django 1.5, import
DeprecationWarningAbnormal. In other words, your code can continue to work, but you should modify it as soon as possible.
In Django 1.6, import
django.contrib.localflavorIt will not continue to work.
This paper is based onCC BY-NC-SA 3.0Please keep the author’s signature and the source of the article.
Django document collaborative translation teamWe are short of staff. Interested friends can join us. It is totally public welfare. Communication group: 467338606.