#36250: `admin.widgets.RelatedFieldWidgetWrapper.get_context()` bypasses the 
used
renderer
----------------------------+-----------------------------------------
     Reporter:  Jacob Rief  |                     Type:  Bug
       Status:  new         |                Component:  contrib.admin
      Version:  5.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
----------------------------+-----------------------------------------
 In django.contrib.admin, `ForeignKey` and `ManyToManyField` are mapped to
 a `admin.widgets.RelatedFieldWidgetWrapper`. This wrapper widget then
 renders the underling widget using:

 {{{
 def get_context(self, name, value, attrs):
     ...
     context = {
        "rendered_widget": self.widget.render(name, value, attrs),
         ...
     }
     ...
 }}}

 If the `RelatedFieldWidgetWrapper` itself has been rendered using an
 alternative renderer, the underling widgets will be rendered using the
 default renderer instead of the alternative renderer as used to render the
 said wrapper widget. This may lead to unexpected output.

 Possible solution:

 By adding the optional argument `renderer` to the `get_context()`-method,
 the widget rendering function could be rewritten as
 `self.widget.render(name, value, attrs, renderer=renderer)`.

 This issue might be related to #34257.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36250>
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 visit 
https://groups.google.com/d/msgid/django-updates/010701958adae768-b1dab1c9-31a5-44a2-a525-0fb0027dcae5-000000%40eu-central-1.amazonses.com.

Reply via email to