Django 1.8 official document translation: 9-2 additional functions of “local characteristics”

Time:2021-2-27

Additional functions of “local characteristics”

Due to historical factors, Django brought his owndjango.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:

https://django-localflavor.readthedocs.org/

The code is hosted on GitHub,https://github.com/django/django-localflavor

How to migrate

If you use the old version ofdjango.contrib.localflavorBags, ordjango-localflavor-*Follow these two simple steps to update your code

  • Installing third party’s in pypidjango-localflavorBag.

  • Modify the import statement you apply to reference the new package.

    For example:
    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.

Abandonment policy

In Django 1.5, importdjango.contrib.localflavorWill produceDeprecationWarningAbnormal. In other words, your code can continue to work, but you should modify it as soon as possible.

In Django 1.6, importdjango.contrib.localflavorIt will not continue to work.

translator:Django document collaborative translation teamOriginal text:“Local flavor”

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.

Recommended Today

Redis design and implementation 4: Dictionary Dict

In redis, the dictionary is the infrastructure. Redis database data, expiration time and hash type all take the dictionary as the underlying structure. Structure of dictionary Hashtable The implementation code of hash table is as follows:dict.h/dictht The dictionary of redis is implemented in the form of hash table. typedef struct dictht { //Hash table array, […]