A
A
asdevlog2019-01-12 10:44:04
Python
asdevlog, 2019-01-12 10:44:04

Incomprehensible Form behavior in Flask how to understand what's wrong?

Good afternoon.
There was a small problem which I can not solve in any way.
An error occurs when trying to read or write values ​​to / from the form

AttributeError: 'tuple' object has no attribute 'strftime'

I started debugging and found the following,
5c399a10c5fc3304764394.jpeg
first the fields have the same type and everything seems to be fine. But after the assignment, the form field takes on the tuple type ... I don’t understand why.
5c399a576a81e905379339.jpeg
Other similar forms work fine.
This error appeared at the moment when I accidentally clicked on the fix icon in PyCharm and there was something with the word Tuple ... visually nothing has changed but now there is this error =(

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andy_U, 2019-01-12
@asdevlog

Are the commas at the end of the lines unnecessary?

J
JRazor, 2019-01-12
@JRazor

The order is something like this:
1) You look at sp_driverList.dl_data - what is the value and type before assigning the form
2) If everything is fine there, then somewhere in the form the field is being converted to a tuple
3) If the form is a regular ModelForm without redefining fields - you go to look model
Up to 3 points, usually no one reaches - the mistake most often lies in the first two options

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question