Vanderson Ramos
Vanderson Ramos

Reputation: 341

Default format datetime Django 1.6

I have a project in Django 1.6 and a configuration file called formats.py, it is defined as I want the date to appear in my project. In my settings I tell the FORMAT_MODULE_PATH the path to that file,but Django is ignoring this file and whenever I have the need display date use filters. How do I stop the default date format in the project?

My formats.py

 DATE_FORMAT = '%d/%m/%Y'
 DATETIME_FORMAT = '%d/%m/%Y %H:%M:%S'
 DATE_INPUT_FORMATS = ('%d/%m/%Y', '%d/%m/%y', '%Y-%m-%d')

in my settings i use:

FORMAT_MODULE_PATH = 'myproject.formats'

Structure:

myproject /
  formats /
    init.py
    pt_BR /
      init.py
      formats.py

Upvotes: 2

Views: 554

Answers (1)

rockingskier
rockingskier

Reputation: 9346

You need an __init__.py in your formats folder as well as each language folder

myproject /
    formats /
        init.py  # <----- 
        pt_BR /
            init.py
            formats.py

Docs

Upvotes: 1

Related Questions