Field type Date Field in python?

1

I have a table that has a date field that only collects the date. My question is how to specify the format in which that date will enter. If this is the 01 MAR 2016 format, how do I specify it is day, month and year?

Example : fecha = models.DateField(null=False, max_length=50)

    
asked by Coloma 20.05.2016 в 21:06
source

1 answer

1

In your settings.py file

DATE_INPUT_FORMATS = ('%d-%m-%Y',)

And in your class

 fecha = DateField(input_formats=settings.DATE_INPUT_FORMATS)

But you have to have this value to false, to avoid it occupying location:

USE_L10N = False
    
answered by 20.05.2016 в 22:24