#34445: DateField.input_formats cannot be printed
-----------------------------------------+------------------------
               Reporter:  stefan6419846  |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  3.2
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 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.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34445>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701872c29652c-6af261a8-e085-40ec-b1de-6cbc5aaeb3df-000000%40eu-central-1.amazonses.com.

Reply via email to