jazzband / django-smart-selects

chained and grouped selects for django forms
https://django-smart-selects.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.1k stars 348 forks source link

Fixed bug with missing "renderer" parameter in widgets.py render methods #272

Closed glenngaetz closed 4 years ago

glenngaetz commented 5 years ago

In Django 2.1, forms with chained fields get a TypeError "render() got an unexpected keyword argument 'renderer'". Apparently render() now requires a "renderer" parameter.

https://docs.djangoproject.com/en/2.0/ref/forms/widgets/#django.forms.Widget.render

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 89.809% when pulling 522d0d4fdbc7e7fec02c2d3b3e7251f40f2b911b on glenngaetz:master into ca55e0bc8ad378dc7a3d1bb5e68e18e8fc51c546 on digi604:master.

TomSteck commented 5 years ago

I updated my local widgets.py with glenngaetz commit (pip downloads django-smart-selects==1.5.4 with older file) and now Django (2.1.5) doesn't return any errors. However widget doesn't return any values. I use jquery-3.3.1 and django-cities-light:

    from smart_selects.db_fields import ChainedForeignKey
    from cities_light.models import Country, City

    class User(AbstractUser):
        country = models.ForeignKey(Country, on_delete=models.PROTECT, null=True)
        city = ChainedForeignKey(
            City,
            chained_field="country",
            chained_model_field="country_id",
            show_all=False,
            auto_choose=True,
            sort=True,
            null=True)
manelclos commented 4 years ago

@glenngaetz thanks for explaining the problem and pointing to the documentation. This makes sense, merging.