From 4e7a8ad1e7104ff11df24ab71aed31f8b62da487 Mon Sep 17 00:00:00 2001
From: Dominik George <nik@naturalnet.de>
Date: Thu, 2 Aug 2018 13:18:54 +0200
Subject: [PATCH] Fix widget context access.

---
 django_starfield/templates/django_starfield/stars.html | 6 +++---
 django_starfield/widgets.py                            | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/django_starfield/templates/django_starfield/stars.html b/django_starfield/templates/django_starfield/stars.html
index bc73767..b2178c0 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 ae0aec5..c6886c7 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
-- 
GitLab