Hey Adam, yeah I figured it was most likely a design decision to not 
incorporate request in forms. Thanks for the feedback!

On Tuesday, May 24, 2022 at 3:12:04 AM UTC-5 Adam Johnson wrote:

> I don't think this is a good idea, it couples forms too tightly to 
> requests. The idea of a form is to take dictionaries of form inputs, and 
> validate those. It shouldn't need the request.
>
> If I write a form class that needs extra things from the request, I write 
> my form class to take just that thing. For example, the current user from 
> request.user.
>
> On Tue, May 24, 2022 at 2:05 AM Douglas Mumme <doug...@gmail.com> wrote:
>
>> Hey all,
>>
>> I've recently made a ticket to add the request object as an optional 
>> input to the BaseForm class so that it will easily input for any form if 
>> it's needed.
>>
>> I found out that something like this has been requested before and 
>> resolved as a "won't fix", but I think adding it as an optional input will 
>> be an easy way developers can pass it through when needed without having to 
>> subclass the Form class.
>>
>> I think a lot of people need the request object in forms for validation 
>> and for queryset filtering and this will make life just a little easier.
>>
>> I would love to hear everyone's thoughts and if this is a good idea.
>>
>> Thanks!
>>
>> Ticket url: https://code.djangoproject.com/ticket/33732
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/cd528f14-322b-4786-986c-82f06172ea4en%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-developers/cd528f14-322b-4786-986c-82f06172ea4en%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/c9f7400a-a53c-4104-97d3-31da9d7f2220n%40googlegroups.com.
  • Add... Douglas Mumme
    • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
      • ... Douglas Mumme

Reply via email to