{"title":"The “local flavor” add-ons","version":"1.8","locale":"en","docname":"topics/localflavor","url":"/en/1.8/topics/localflavor/","canonical":"https://djangodocs.dev/en/1.8/topics/localflavor/","summary":"Historically, Django has shipped with django.contrib.localflavor – assorted pieces of code that are useful for particular countries or cultures. This code is now…","html":"<h1>The “local flavor” add-ons<a class=\"heading-anchor\" href=\"#the-local-flavor-add-ons\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>Historically, Django has shipped with <code class=\"docutils literal notranslate\"><span class=\"pre\">django.contrib.localflavor</span></code> –\nassorted pieces of code that are useful for particular countries or cultures.\nThis code is now distributed separately from Django, for easier maintenance\nand to trim the size of Django’s codebase.</p>\n<p>See the official documentation for more information:</p>\n<blockquote>\n<div><p><a class=\"reference external\" href=\"https://django-localflavor.readthedocs.org/\">https://django-localflavor.readthedocs.org/</a></p>\n</div></blockquote>\n<p id=\"localflavor-packages\">Code is hosted on github at <a class=\"reference external\" href=\"https://github.com/django/django-localflavor\">https://github.com/django/django-localflavor</a>.</p>\n<section id=\"how-to-migrate\">\n<span id=\"localflavor-how-to-migrate\"></span><h2>How to migrate<a class=\"heading-anchor\" href=\"#how-to-migrate\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>If you’ve used the old <code class=\"docutils literal notranslate\"><span class=\"pre\">django.contrib.localflavor</span></code> package or one of the\ntemporary <code class=\"docutils literal notranslate\"><span class=\"pre\">django-localflavor-*</span></code> releases, follow these two easy steps to\nupdate your code:</p>\n<ol class=\"arabic\">\n<li><p>Install the third-party <code class=\"docutils literal notranslate\"><span class=\"pre\">django-localflavor</span></code> package from PyPI.</p></li>\n<li><p>Change your app’s import statements to reference the new package.</p>\n<p>For example, change this:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span><span class=\"w\"> </span><span class=\"nn\">django.contrib.localflavor.fr.forms</span><span class=\"w\"> </span><span class=\"kn\">import</span> <span class=\"n\">FRPhoneNumberField</span>\n</code></pre></div>\n<p>…to this:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span><span class=\"w\"> </span><span class=\"nn\">localflavor.fr.forms</span><span class=\"w\"> </span><span class=\"kn\">import</span> <span class=\"n\">FRPhoneNumberField</span>\n</code></pre></div>\n</li>\n</ol>\n<p>The code in the new package is the same (it was copied directly from Django),\nso you don’t have to worry about backwards compatibility in terms of\nfunctionality. Only the imports have changed.</p>\n</section>\n<section id=\"deprecation-policy\">\n<span id=\"localflavor-deprecation-policy\"></span><h2>Deprecation policy<a class=\"heading-anchor\" href=\"#deprecation-policy\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>In Django 1.5, importing from <code class=\"docutils literal notranslate\"><span class=\"pre\">django.contrib.localflavor</span></code> will result in a\n<code class=\"docutils literal notranslate\"><span class=\"pre\">DeprecationWarning</span></code>. This means your code will still work, but you should\nchange it as soon as possible.</p>\n<p>In Django 1.6, importing from <code class=\"docutils literal notranslate\"><span class=\"pre\">django.contrib.localflavor</span></code> will no longer\nwork.</p>\n</section>","rootId":"the-local-flavor-add-ons","toc":[{"title":"How to migrate","anchor":"how-to-migrate","children":[]},{"title":"Deprecation policy","anchor":"deprecation-policy","children":[]}],"breadcrumbs":[{"docname":"topics/index","title":"Using Django","url":"/en/1.8/topics/"}],"prev":{"docname":"topics/i18n/timezones","title":"Time zones","url":"/en/1.8/topics/i18n/timezones/"},"next":{"docname":"topics/logging","title":"Logging","url":"/en/1.8/topics/logging/"},"formats":{"html":"/en/1.8/topics/localflavor/","markdown":"/en/1.8/topics/localflavor.md","json":"/en/1.8/topics/localflavor.json"},"source":"https://github.com/django/django/blob/stable/1.8.x/docs/topics/localflavor.txt","official":"https://docs.djangoproject.com/en/1.8/topics/localflavor/","inVersions":["1.8"],"inLocales":["en"]}