#13972: Field initial value callable should take a request object as an argument
-------------------------------------+-------------------------------------
     Reporter:  mitar                |                    Owner:  nobody
         Type:  New feature          |                   Status:  closed
    Component:  Forms                |                  Version:  1.2
     Severity:  Normal               |               Resolution:  wontfix
     Keywords:                       |             Triage Stage:  Design
    Has patch:  0                    |  decision needed
  Needs tests:  0                    |      Needs documentation:  0
Easy pickings:  0                    |  Patch needs improvement:  0
                                     |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by mitar):

 I know that I can do this in the view. But I find this not a nice
 separation programming logic. Then I have to repeat again and again this
 in all the views, where it could just be a nature of the view. Yes, I
 could create a mixin for class-based views to handle this, but it is still
 complicating things. `request` should really be available everywhere. Like
 there is a way (processors) to get it into the templates, there should be
 a way to get it into forms.

 Maybe better way would be that default values functions could be methods
 of form? So then you would access to `self` where you could store anything
 you want (or pass `request` in the constructor).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/13972#comment:9>
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 post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to