diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-01-04 11:48:06 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-01-04 11:48:06 +0100 |
commit | 2f0bfdd8283b7191789de1032f73f14ebb2df337 (patch) | |
tree | 7fbbac98ede2372e672e3a855582d8dfc2ccb0f9 | |
parent | ef4426b43970c210a34d8361057b2ff65733ab48 (diff) | |
download | Ishtar-2f0bfdd8283b7191789de1032f73f14ebb2df337.tar.bz2 Ishtar-2f0bfdd8283b7191789de1032f73f14ebb2df337.zip |
Select2widget: fix bad initialization
-rw-r--r-- | archaeological_finds/views.py | 3 | ||||
-rw-r--r-- | ishtar_common/widgets.py | 6 |
2 files changed, 4 insertions, 5 deletions
diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py index 3442ed2f4..fb5cdc11e 100644 --- a/archaeological_finds/views.py +++ b/archaeological_finds/views.py @@ -293,14 +293,11 @@ def find_modify(request, pk): q = models.Find.objects.filter(pk=pk) if not q.count(): raise Http404() - step = "selecrecord-find_modification" - ''' step = 'find-find_modification' find = q.all()[0] if find.base_finds.count() > 1: step = 'simplefind-find_modification' - ''' return redirect( reverse('find_modification', kwargs={'step': step})) diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 95b51ffb4..5853c9675 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -224,6 +224,10 @@ class Select2Base(Select2Media): else: attrs['style'] = "width: 370px" + if value: + if type(value) not in (list, tuple): + value = value.split(',') + options = "" if self.remote: options = """{ @@ -248,8 +252,6 @@ class Select2Base(Select2Media): }""" % self.remote if value: choices = [] - if type(value) not in (list, tuple): - value = value.split(',') for v in value: try: choices.append((v, self.model.objects.get(pk=v))) |