from django import forms


class ImageWidget(forms.FileInput):
    """
    A ImageField Widget that shows a thumbnail.
    """

    def __init__(self, attrs={}):
        super(ImageWidget, self).__init__(attrs)

    def render(self, name, value, attrs=None):
        output = super(ImageWidget, self).render(name, value, attrs)
        if value and hasattr(value, 'url'):
            output = ('<div class="val-wrap"><img src="%s" alt="" />%s</div>' %
                      (value.url, output))
        return output

from django import forms


class ImageWidget(forms.FileInput):
    """
    A ImageField Widget that shows a thumbnail.
    """

    def __init__(self, attrs={}):
        super(ImageWidget, self).__init__(attrs)

    def render(self, name, value, attrs=None, renderer=None):
        output = super(ImageWidget, self).render(name, value, attrs, renderer=renderer)
        if value and hasattr(value, 'url'):
            output = ('<div class="val-wrap"><img src="%s" alt="" />%s</div>' %
                      (value.url, output))
        return output

Add required renderer argument to Widget.render() call
Add required renderer argument to Widget.render() call

mozilla/sumo-project#136

  from django import forms
  
  
  class ImageWidget(forms.FileInput):
      """
      A ImageField Widget that shows a thumbnail.
      """
  
      def __init__(self, attrs={}):
          super(ImageWidget, self).__init__(attrs)
  
-     def render(self, name, value, attrs=None):
+     def render(self, name, value, attrs=None, renderer=None):
-         output = super(ImageWidget, self).render(name, value, attrs)
+         output = super(ImageWidget, self).render(name, value, attrs, renderer=renderer)
          if value and hasattr(value, 'url'):
              output = ('<div class="val-wrap"><img src="%s" alt="" />%s</div>' %
                        (value.url, output))
          return output
  
Add required renderer argument to Widget.render() call
## Code Before:
from django import forms


class ImageWidget(forms.FileInput):
    """
    A ImageField Widget that shows a thumbnail.
    """

    def __init__(self, attrs={}):
        super(ImageWidget, self).__init__(attrs)

    def render(self, name, value, attrs=None):
        output = super(ImageWidget, self).render(name, value, attrs)
        if value and hasattr(value, 'url'):
            output = ('<div class="val-wrap"><img src="%s" alt="" />%s</div>' %
                      (value.url, output))
        return output

## Instruction:
Add required renderer argument to Widget.render() call
## Code After:
from django import forms


class ImageWidget(forms.FileInput):
    """
    A ImageField Widget that shows a thumbnail.
    """

    def __init__(self, attrs={}):
        super(ImageWidget, self).__init__(attrs)

    def render(self, name, value, attrs=None, renderer=None):
        output = super(ImageWidget, self).render(name, value, attrs, renderer=renderer)
        if value and hasattr(value, 'url'):
            output = ('<div class="val-wrap"><img src="%s" alt="" />%s</div>' %
                      (value.url, output))
        return output
