#34385: BaseTemporalField child fields causing AttributeError to be raised by
calling form.is_valid().
-------------------------------------+-------------------------------------
     Reporter:  Fábio David Freitas  |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Forms                |                  Version:  4.1
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:  DateField            |             Triage Stage:
  DateTimeField validation           |  Unreviewed
  AttributeError                     |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Fábio David Freitas):

 Replying to [comment:1 Mariusz Felisiak]:
 > Thanks for this ticket, however I don't see anything wrong in this
 behavior, `to_python()` accepts the raw value from the widget i.e. string,
 and it's not designed to accept anything and never crash. Can you explain
 how you ended up with passing `int` to this method?

 Thanks for the response, that makes sense. What I did in my code to get
 this behavior is basically the first code section of `Reproducing the
 problem` from the ticket, which is creating a form with a `DateField` and
 populating it with data when instantiating the form. I am only using the
 form for validation, but the actual input comes from a JSON request.

 From your response I am getting the impression that django forms are only
 supposed to be used when it's gonna be populated by the form itself on the
 template. Is that the case? I was under the impression that forms could be
 used as a "Struct with validation and streamlined model access".

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34385#comment:2>
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/01070186a8bb48b7-54fe5cc0-df0b-495c-8804-205f87dd9721-000000%40eu-central-1.amazonses.com.

Reply via email to