#34445 closed Bug (fixed)
DateField.input_formats cannot be printed
Reported by: | stefan6419846 | Owned by: | David Sanders |
---|---|---|---|
Component: | Utilities | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I am trying to display the input formats for django.forms.fields.DateField
. This seems to fail at the moment when using __str__
, while __repr__
works.
Example code:
from django.forms.fields import DateField print(repr(DateField().input_formats)) print(DateField().input_formats)
This will result in the following error:
Traceback (most recent call last): File "<console>", line 1, in <module> TypeError: __str__ returned non-string (type list)
I would have expected the string representation to be available as well instead of failing with an internal Python error.
Change History (6)
comment:2 by , 20 months ago
Component: | Uncategorized → Utilities |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Bug |
comment:3 by , 20 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 20 months ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
Hi, thanks for the report!
Interesting:
Confirmed str() is returning a list.