diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-06-11 12:24:56 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-06-11 12:24:56 +0200 |
commit | 60ffe85e152c2e279929f7bde7c670c411a2e2f3 (patch) | |
tree | 05a8988c04a960f11a9500fb10e0a737514d1c96 /ishtar/furnitures/widgets.py | |
parent | 55296f31186e411094fee42c0d559cbb354fff7c (diff) | |
download | Ishtar-60ffe85e152c2e279929f7bde7c670c411a2e2f3.tar.bz2 Ishtar-60ffe85e152c2e279929f7bde7c670c411a2e2f3.zip |
Correct bad interaction between DatePicker and Autocomplete fields (closes #431) + minor CSS
Diffstat (limited to 'ishtar/furnitures/widgets.py')
-rw-r--r-- | ishtar/furnitures/widgets.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ishtar/furnitures/widgets.py b/ishtar/furnitures/widgets.py index 596abf784..d70f08dda 100644 --- a/ishtar/furnitures/widgets.py +++ b/ishtar/furnitures/widgets.py @@ -92,9 +92,11 @@ class JQueryDate(forms.TextInput): class JQueryDate(forms.TextInput):
def render(self, name, value=None, attrs=None):
rendered = super(JQueryDate, self).render(name, value, attrs)
+ # use window.onload to be sure that datepicker don't interfere
+ # with autocomplete fields
rendered += """
<script type="text/javascript"><!--//
- $(function() {
+ $(window).load(function() {
$("#id_%(name)s").datepicker($.datepicker.regional["%(country)s"]);
var val = $("#id_%(name)s").val();
if(val){
@@ -177,8 +179,8 @@ objects.get(pk=value)) if self.new:
model_name = self.associated_model._meta.object_name.lower()
url_new = reverse('new-' + model_name, args=[attrs_select['id']])
- new = u' <a href="#" onclick="open_window(\'%s\');">%s</a>' % (
- url_new, unicode(_(u"Add")))
+ new = u' <a href="#" class="add-button" '\
+ u'onclick="open_window(\'%s\');">+</a>' % url_new
html = u'''<input%(attrs_select)s/>%(new)s\
<input type="hidden"%(attrs_hidden)s/>\
<script type="text/javascript"><!--//
|