From 16e296d9f4c777df35f0cb8a7446a0ee48b18ff6 Mon Sep 17 00:00:00 2001 From: Sanj Date: Fri, 20 Jul 2012 03:03:40 +0530 Subject: [PATCH] try and deal with widget value nonsense --- itf/app/forms.py | 4 +++- itf/templates/formwidgets/select2.html | 2 +- itf/templates/test/person_form.html | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/itf/app/forms.py b/itf/app/forms.py index 7e5a16e..8b71923 100644 --- a/itf/app/forms.py +++ b/itf/app/forms.py @@ -39,7 +39,9 @@ class AutocompleteAddWidget(forms.Select): if choice[0] == id: return choice[1] return '' - + + #import pdb + #pdb.set_trace() ctx = super(AutocompleteAddWidget, self).get_context(name, value, attrs) if value: ctx['title'] = get_matched_choice_title(self.choices, value) diff --git a/itf/templates/formwidgets/select2.html b/itf/templates/formwidgets/select2.html index 6166b9a..4e85236 100644 --- a/itf/templates/formwidgets/select2.html +++ b/itf/templates/formwidgets/select2.html @@ -1,2 +1,2 @@ - + + + diff --git a/itf/templates/test/person_form.html b/itf/templates/test/person_form.html index 87a4a86..f903eb0 100644 --- a/itf/templates/test/person_form.html +++ b/itf/templates/test/person_form.html @@ -77,6 +77,7 @@ $(function(){ } }); var id = $this.attr("data-id"); + console.log(id); if ($.trim(id) !== '') { var title = $this.attr("data-title"); $this.select2("val", {'id': id, 'title': title});