From faf8f63aab6bbc9ba9b5495fe07878cd7c3c4954 Mon Sep 17 00:00:00 2001 From: Dominik George <nik@naturalnet.de> Date: Thu, 2 Aug 2018 14:50:31 +0200 Subject: [PATCH] Fix widget config. --- django_starfield/widgets.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/django_starfield/widgets.py b/django_starfield/widgets.py index 04abbf3..02f6d99 100644 --- a/django_starfield/widgets.py +++ b/django_starfield/widgets.py @@ -11,12 +11,9 @@ class Stars(Widget): def __init__(self, attrs=None, stars=None, codepoint=None, colour=None): super(Stars, self).__init__(attrs) - if stars is None: - self.stars = getattr(settings, 'STARFIELD_STARS', STARFIELD_STARS) - if codepoint is None: - self.codepoint = getattr(settings, 'STARFIELD_CODEPOINT', STARFIELD_CODEPOINT) - if colour is None: - self.colour = getattr(settings, 'STARFIELD_COLOUR', STARFIELD_COLOUR) + self.stars = stars if stars else getattr(settings, 'STARFIELD_STARS', STARFIELD_STARS) + self.codepoint = codepoint if codepoint else getattr(settings, 'STARFIELD_CODEPOINT', STARFIELD_CODEPOINT) + self.colour = colour if colour else getattr(settings, 'STARFIELD_COLOUR', STARFIELD_COLOUR) def get_context(self, name, value, attrs): context = super(Stars, self).get_context(name, value, attrs) -- GitLab