comparison gpp/core/widgets.py @ 6:b6263ac72052

Use DRY principle to manage third party javascript libraries. Created script_tags template tags to generate the correct link and script tags for 3rd party libraries. The settings.py file is the only place where the full path name is specified.
author Brian Neal <bgneal@gmail.com>
date Sat, 11 Apr 2009 22:50:56 +0000
parents dbd703f7d63a
children cc8eb028def1
comparison
equal deleted inserted replaced
5:63696b279e35 6:b6263ac72052
3 """ 3 """
4 4
5 from django import forms 5 from django import forms
6 from django.utils.safestring import mark_safe 6 from django.utils.safestring import mark_safe
7 from django.core.urlresolvers import reverse 7 from django.core.urlresolvers import reverse
8 from django.conf import settings
8 9
9 10
10 class AutoCompleteUserInput(forms.TextInput): 11 class AutoCompleteUserInput(forms.TextInput):
11 class Media: 12 class Media:
12 css = { 13 css = {
13 'all': ('js/jquery-autocomplete/jquery.autocomplete.css',) 14 'all': settings.GPP_THIRD_PARTY_CSS['jquery-autocomplete'],
14 } 15 }
15 js = ( 16 js = settings.GPP_THIRD_PARTY_JS['jquery-autocomplete']
16 'js/jquery-autocomplete/lib/jquery.js',
17 'js/jquery-autocomplete/lib/jquery.bgiframe.min.js',
18 'js/jquery-autocomplete/lib/jquery.ajaxQueue.js',
19 'js/jquery-autocomplete/jquery.autocomplete.js'
20 )
21 17
22 def render(self, name, value, attrs=None): 18 def render(self, name, value, attrs=None):
23 url = reverse('messages-ajax_users') 19 url = reverse('messages-ajax_users')
24 output = super(AutoCompleteUserInput, self).render(name, value, attrs) 20 output = super(AutoCompleteUserInput, self).render(name, value, attrs)
25 return output + mark_safe(u'''\ 21 return output + mark_safe(u'''\