mirumee / django-prices

Django fields for the prices module
158 stars 53 forks source link

Passing a widget instance to MoneyField produce crash #88

Closed NyanKiyoshi closed 5 years ago

NyanKiyoshi commented 5 years ago

For example, when doing:

field = MoneyField(widget=MyWidget())

Would produce:

  File "/Users/mikail/Development/saleor/saleor/urls.py", line 14, in <module>
    from .dashboard.urls import urlpatterns as dashboard_urls
  File "/Users/mikail/Development/saleor/saleor/dashboard/urls.py", line 8, in <module>
    from .discount.urls import urlpatterns as discount_urls
  File "/Users/mikail/Development/saleor/saleor/dashboard/discount/urls.py", line 3, in <module>
    from . import views
  File "/Users/mikail/Development/saleor/saleor/dashboard/discount/views.py", line 15, in <module>
    from . import forms
  File "/Users/mikail/Development/saleor/saleor/dashboard/discount/forms.py", line 28, in <module>
    (currency, currency) for currency in settings.AVAILABLE_CURRENCIES
  File "/Users/mikail/Development/saleor-venv/lib/python3.7/site-packages/django_prices/forms.py", line 49, in __init__
    fields, widget=widget_instance, *args, **kwargs
UnboundLocalError: local variable 'widget_instance' referenced before assignment
NyanKiyoshi commented 5 years ago

This was actually fixed in 2.1.0a1