jazzband / django-floppyforms

Full control of form rendering in the templates.
http://django-floppyforms.readthedocs.org/
Other
837 stars 148 forks source link

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

Closed Gwildor closed 4 years ago

Gwildor commented 7 years ago

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.

lzanuz commented 6 years ago

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 commented 6 years ago

+1

bnisevic commented 6 years ago

Btw, we don't use floppyforms anymore.

johnnyrockets commented 6 years ago

+1

lzanuz commented 6 years ago

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

Jasper-Koops commented 6 years ago

Has the issue been fixed?

amenoni commented 6 years ago

+1

eyesee1 commented 6 years ago

+1

skar3 commented 6 years ago

+1

oTree-org commented 6 years ago

+1

fronbasal commented 6 years ago

+1

brent960 commented 6 years ago

+1

chrnolte commented 6 years ago

+1

intelef commented 6 years ago

+1

joaobarcia commented 6 years ago

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 commented 6 years ago

Please!

manojrege commented 6 years ago

Fixed here: https://github.com/gregmuellegger/django-floppyforms/pull/193

lokkomokko commented 6 years ago

I have simillar problem on django 2.0.2 , please help somebody

davewilliamstx commented 6 years ago

Fix 193 from @manojrege works for me!

alemangui commented 6 years ago

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

jojjo64 commented 6 years ago

+1

nnamdiib commented 6 years ago

@manojrege Thanks man!

amirasaad commented 5 years ago

+1

n6151h commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

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