diff --git a/django_starfield/templates/django_starfield/stars.html b/django_starfield/templates/django_starfield/stars.html index bc737679d8418567dbc3dcda470d166cd9e8dc44..b2178c0d52609213d2a5bce8ef6998af6b756d80 100644 --- a/django_starfield/templates/django_starfield/stars.html +++ b/django_starfield/templates/django_starfield/stars.html @@ -1,9 +1,9 @@ {% load static %} <div class="django-starfield"> {% for i in stars %}<!-- - --><input type="radio" name="{{ name }}" id="{{ name }}-{{ forloop.counter0 }}" - value="{{ i }}" {% if value == i %}checked="checked"{% endif %} /><!-- - --><label for="{{ name }}-{{ forloop.counter0 }}" + --><input type="radio" name="{{ widget.name }}" id="{{ widget.name }}-{{ forloop.counter0 }}" + value="{{ i }}" {% if widget.value == i %}checked="checked"{% endif %} /><!-- + --><label for="{{ widget.name }}-{{ forloop.counter0 }}" style="content: '\{{ codepoint }}'">{{ i }}</label><!-- -->{% endfor %} </div> diff --git a/django_starfield/widgets.py b/django_starfield/widgets.py index ae0aec541e3074d3b3e267b3e7dd0b03c8943fbf..c6886c7fad70a517f00aafd4fbd7fd3d4609f53e 100644 --- a/django_starfield/widgets.py +++ b/django_starfield/widgets.py @@ -11,4 +11,5 @@ class Stars(Widget): def get_context(self, name, value, attrs): context = super(Stars, self).get_context(name, value, attrs) context['stars'] = range(self.stars, 0, -1) + context['codepoint'] = self.codepoint return context