Answer the question
In order to leave comments, you need to log in
How to write date to db?
An error occurs when trying to write a date to the model and then save it.
new = Raspisanie("2013-01-01")
new.save();
invalid literal for int() with base 10: '2013-01-01'
Answer the question
In order to leave comments, you need to log in
You are trying to write the string "2013-01-01", not the date.
For starters, read about the datetime type in python
If everything is correct the DateField expects a datetime object as webus mentioned.
About datetime in general, you can also find about strptime there if you directly need to create a date from a string.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question