#27240: Passing custom parameters to formset forms in admin
-------------------------------------+-------------------------------------
     Reporter:  arogachev            |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Documentation        |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  admin, form,         |             Triage Stage:
  formset, parameter                 |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by knbk):

 I'm currently using the following pattern to solve the same problem with
 forms:

 {{{
 def get_form(self, request, obj=None, **kwargs):
     Form = super().get_form(request, obj=None, **kwargs)
     return functools.partial(Form, user=request.user)
 }}}

 Using a class attribute can suffer from thread-safety issues when handling
 concurrent requests.

--
Ticket URL: <https://code.djangoproject.com/ticket/27240#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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.d84f473b314c449427010c30cf3a0605%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to