mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #20477: Allowed list of modules for FORMAT_MODULE_PATH
Previously the FORMAT_MODULE_PATH setting only accepted one string (dotted module path). A feature has been added to also allow a list of strings. This is useful when using several reusable third party apps that define new formats. We can now use them all and we can even override some of the formats by providing a project-wide format module.
This commit is contained in:
committed by
Tim Graham
parent
dfeef8e147
commit
bb0a9a070b
@@ -154,11 +154,20 @@ Django provides format definitions for many locales, but sometimes you might
|
||||
want to create your own, because a format files doesn't exist for your locale,
|
||||
or because you want to overwrite some of the values.
|
||||
|
||||
To use custom formats, specify the path where you'll place format files first.
|
||||
To do that, just set your :setting:`FORMAT_MODULE_PATH` setting to the package
|
||||
where format files will exist, for instance::
|
||||
|
||||
FORMAT_MODULE_PATH = 'mysite.formats'
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
The ability to specify :setting:`FORMAT_MODULE_PATH` as a list was added.
|
||||
Previously, only a single string value was supported.
|
||||
|
||||
To use custom formats, specify the path where you'll place format files
|
||||
first. To do that, just set your :setting:`FORMAT_MODULE_PATH` setting to
|
||||
the package where format files will exist, for instance::
|
||||
|
||||
FORMAT_MODULE_PATH = [
|
||||
'mysite.formats',
|
||||
'some_app.formats',
|
||||
]
|
||||
|
||||
Files are not placed directly in this directory, but in a directory named as
|
||||
the locale, and must be named ``formats.py``.
|
||||
|
||||
Reference in New Issue
Block a user