fix to work with latest django-select2 4
authorFrédéric Péters <fpeters@0d.be>
Tue, 18 Apr 2017 14:14:36 +0000 (16:14 +0200)
committerFrédéric Péters <fpeters@0d.be>
Tue, 18 Apr 2017 14:14:36 +0000 (16:14 +0200)
panikombo/forms.py

index 01fb013..6e499e0 100644 (file)
@@ -1,5 +1,7 @@
+import json
+
 from django import forms
-from django_select2.widgets import HeavySelect2Widget, convert_to_js_string_arr
+from django_select2.widgets import HeavySelect2Widget
 from taggit.forms import TagWidget
 
 from emissions.models import SoundFile, Episode
@@ -16,7 +18,7 @@ class SoundFileWidget(HeavySelect2Widget):
                     soundfile.episode.title,
                     soundfile.title or soundfile.id)
         texts = [fmt(soundfile) for soundfile in queryset.select_related()]
-        return convert_to_js_string_arr(texts)
+        return json.dumps(texts)
 
 
 class SoundCellForm(forms.ModelForm):
@@ -35,7 +37,7 @@ class EpisodeWidget(HeavySelect2Widget):
         def fmt(episode):
             return '%s - %s' % (episode.emission.title, episode.title)
         texts = [fmt(episode) for episode in queryset.select_related()]
-        return convert_to_js_string_arr(texts)
+        return json.dumps(texts)
 
 
 class EpisodeCellForm(forms.ModelForm):