gremmie@1: """ gremmie@1: Various useful widgets for the GPP application. gremmie@1: """ gremmie@1: gremmie@1: from django import forms gremmie@1: from django.utils.safestring import mark_safe gremmie@1: from django.core.urlresolvers import reverse gremmie@1: gremmie@1: gremmie@1: class AutoCompleteUserInput(forms.TextInput): gremmie@1: class Media: gremmie@1: css = { gremmie@1: 'all': ('js/jquery-autocomplete/jquery.autocomplete.css',) gremmie@1: } gremmie@1: js = ( gremmie@1: 'js/jquery-autocomplete/lib/jquery.js', gremmie@1: 'js/jquery-autocomplete/lib/jquery.bgiframe.min.js', gremmie@1: 'js/jquery-autocomplete/lib/jquery.ajaxQueue.js', gremmie@1: 'js/jquery-autocomplete/jquery.autocomplete.js' gremmie@1: ) gremmie@1: gremmie@1: def render(self, name, value, attrs=None): gremmie@1: url = reverse('messages-ajax_users') gremmie@1: output = super(AutoCompleteUserInput, self).render(name, value, attrs) gremmie@1: return output + mark_safe(u'''\ gremmie@1: ''' % (name, url)) gremmie@1: gremmie@1: gremmie@1: # vim: ts=4 sw=4