Mercurial > public > sg101
annotate gpp/core/widgets.py @ 48:31cb8d55e3a1
Fix typo in wsgi file.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 21 Jun 2009 21:31:24 +0000 |
parents | f408971657b9 |
children | 9bfe07c26c78 |
rev | line source |
---|---|
gremmie@1 | 1 """ |
gremmie@1 | 2 Various useful widgets for the GPP application. |
gremmie@1 | 3 """ |
gremmie@1 | 4 |
gremmie@1 | 5 from django import forms |
gremmie@1 | 6 from django.utils.safestring import mark_safe |
gremmie@1 | 7 from django.core.urlresolvers import reverse |
bgneal@6 | 8 from django.conf import settings |
gremmie@1 | 9 |
gremmie@1 | 10 |
gremmie@1 | 11 class AutoCompleteUserInput(forms.TextInput): |
gremmie@1 | 12 class Media: |
gremmie@1 | 13 css = { |
bgneal@6 | 14 'all': settings.GPP_THIRD_PARTY_CSS['jquery-autocomplete'], |
gremmie@1 | 15 } |
bgneal@12 | 16 js = settings.GPP_THIRD_PARTY_JS['jquery-autocomplete'] |
gremmie@1 | 17 |
gremmie@1 | 18 def render(self, name, value, attrs=None): |
gremmie@1 | 19 url = reverse('messages-ajax_users') |
gremmie@1 | 20 output = super(AutoCompleteUserInput, self).render(name, value, attrs) |
gremmie@1 | 21 return output + mark_safe(u'''\ |
gremmie@1 | 22 <script type="text/javascript"> |
gremmie@1 | 23 jQuery("#id_%s").autocomplete("%s", { |
gremmie@1 | 24 width: 150, |
gremmie@1 | 25 max: 10, |
gremmie@1 | 26 highlight: false, |
gremmie@1 | 27 multiple: false, |
gremmie@1 | 28 scroll: true, |
gremmie@1 | 29 scrollHeight: 300, |
gremmie@1 | 30 matchContains: true, |
gremmie@1 | 31 autoFill: true, |
gremmie@1 | 32 }); |
gremmie@1 | 33 </script>''' % (name, url)) |
gremmie@1 | 34 |
gremmie@1 | 35 |
gremmie@1 | 36 # vim: ts=4 sw=4 |