Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error dateTimeField input format

Tags:

python

django

Why does django give me an error:

TypeError: __init__() got an unexpected keyword argument 'input_formats' at 
start_time=models.DateTimeField(input_formats='%d-%m-%y %H:%M')

Is there something wrong with the input format? what should i do if i want the format input to be date - month - year hour minute?

like image 787
hln Avatar asked Oct 21 '22 12:10

hln


1 Answers

You have confused model DateTimeFields and form DateTimeFields. Models don't take input_formats arguments, forms do.

From Working with forms: the form library and API (which is what it sounds like you want) is to help you create HTML forms, do input validation, etc.

From Models and databases: A model is the single, definitive source of data about your data. It contains the essential fields and behaviors of the data you’re storing. Generally, each model maps to a single database table

like image 62
ckhan Avatar answered Oct 30 '22 23:10

ckhan