Skip to content

Commit e949370

Browse files
committed
Fix widget for None icon_url values
1 parent 64262fa commit e949370

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

forecastmanager/widgets.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from wagtail.utils.widgets import WidgetWithScript
77
from wagtail.widget_adapters import WidgetAdapter
88

9-
from forecastmanager.constants import WEATHER_CONDITION_CHOICES, WEATHER_CONDITION_ICONS
9+
from forecastmanager.constants import WEATHER_CONDITION_ICONS
1010

1111

1212
class WeatherSymbolChooserWidget(WidgetWithScript, widgets.TextInput):
@@ -22,7 +22,8 @@ def __init__(self, attrs=None):
2222

2323
def get_context(self, name, value, attrs):
2424
context = super().get_context(name, value, attrs)
25-
context["widget"]["icon_url"] = static("forecastmanager/weathericons/{0}.png".format(value))
25+
if value:
26+
context["widget"]["icon_url"] = static("forecastmanager/weathericons/{0}.png".format(value))
2627
return context
2728

2829
def render_js_init(self, id_, name, value):

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = forecastmanager
3-
version = 0.4.1
3+
version = 0.4.2
44
description = Integration of Weather City Forecasts Manager in Wagtail Projects.
55
long_description = file:README.md
66
long_description_content_type = text/markdown

0 commit comments

Comments
 (0)