Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: get_context() got an unexpected keyword argument 'renderer' on Django 1.11.3 #192

Closed
Gwildor opened this issue Jul 7, 2017 · 27 comments

Comments

@Gwildor
Copy link

Gwildor commented Jul 7, 2017

The error in the title is raised for Floppyforms widgets on Django 1.11.3 because of the change in this ticket (code here). The solution for now is to stay on 1.11.2 or lower until this is fixed in Floppyforms.

@Gwildor Gwildor changed the title TypeError: get_context() got an unexpected keyword argument 'renderer' TypeError: get_context() got an unexpected keyword argument 'renderer' on Django 1.11.3 Jul 7, 2017
emorozov added a commit to emorozov/django-floppyforms that referenced this issue Jul 24, 2017
@lzanuz
Copy link

lzanuz commented Aug 16, 2017

I confirm the problem on django 1.11.4
floppyforms/widgets.py in render(self, name, value, attrs, **kwargs)
get_context() got an unexpected keyword argument 'renderer'
on django==1.11.2 works fine!

@loge-gh
Copy link

loge-gh commented Aug 31, 2017

+1

@bnisevic
Copy link

Btw, we don't use floppyforms anymore.

@johnnyrockets
Copy link

+1

reidransom added a commit to reidransom/django-floppyforms that referenced this issue Sep 14, 2017
@lzanuz
Copy link

lzanuz commented Sep 18, 2017

Nice job @johnnyrockets
@gregmuellegger - Please fix and upload a new version on pip repository.

@Jasper-Koops
Copy link

Has the issue been fixed?

@amenoni
Copy link

amenoni commented Oct 20, 2017

+1

7 similar comments
@eyesee1
Copy link

eyesee1 commented Oct 28, 2017

+1

@skar3
Copy link

skar3 commented Dec 6, 2017

+1

@oTree-org
Copy link

+1

@fronbasal
Copy link

+1

@brent960
Copy link

+1

@chrnolte
Copy link

+1

@intelef
Copy link

intelef commented Jan 14, 2018

+1

@joaobarcia
Copy link

Is there any chance of including the fix in a new release? Or is there any proposed official temp workaround?

I am now upgrading an older Django to 2.0. The project makes use of floppyforms to a great extent, so this would really be a requirement.

THanks

@skar3
Copy link

skar3 commented Feb 14, 2018

Please!

@manojrege
Copy link

manojrege commented Feb 16, 2018

Fixed here: #193

@lokkomokko
Copy link

I have simillar problem on django 2.0.2 , please help somebody

@davewilliamstx
Copy link

Fix 193 from @manojrege works for me!

@alemangui
Copy link

@lokkomokko try @manojrege's fix, it worked for me on django 2.0.2

umid-podo added a commit to podotree/django-floppyforms that referenced this issue Mar 13, 2018
umid-podo added a commit to podotree/django-floppyforms that referenced this issue Mar 13, 2018
umid-podo added a commit to podotree/django-floppyforms that referenced this issue Mar 13, 2018
@jojjo64
Copy link

jojjo64 commented Mar 19, 2018

+1

@nnamdiib
Copy link

@manojrege Thanks man!

@amirasaad
Copy link

+1

@n6151h
Copy link

n6151h commented Nov 27, 2018

There is a larger issue here that shows up in django >= 2.1. All but one of the of the render methods in widgets.py need to have , renderer=None added to their argument list. E.g.

def render(self, name, value, attrs=None, choices=()):

needs to be

def render(self, name, value, attrs=None, choices=(), renderer=None):

@aquilante
Copy link

aquilante commented Apr 12, 2019

I know that this is an old issue but to circumvent the problem i monkeypatched like this:

from floppyforms import widgets
old_render = widgets.Input.render

def patched_render(self, name, value, attrs=None, **kwargs):
    renderer = kwargs.pop('renderer', None)
    if renderer:
        from floppyforms.compat import flatten_contexts
        template_name = kwargs.pop('template_name', None)
        if template_name is None:
            template_name = self.template_name
        context = self.get_context(name, value, attrs=attrs or {}, **kwargs)
        context = flatten_contexts(self.context_instance, context)
        return renderer.render(template_name, context)        
    else:
        return old_render(self, name, value, attrs, **kwargs)

widgets.Input.render = patched_render

I know this is ugly but as a quick fix it does its job.

There is a similar issues with passing extra attrs for the widgets.

@ramonakira
Copy link

We use django-floppyforms in a few of our projects and would greatly appreciate a fix that works with Python 3 and Django 2.2. If you need any help updating this project I offer my assistance.

@rtpg
Copy link
Contributor

rtpg commented Nov 7, 2019

I believe that all of y'all's issues should be fixed with the latest release (1.8.0).

If you hit any issues still with that release, please re-open this issue/create a new issue and we'll see what we can do

@rtpg rtpg closed this as completed Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests