annotate gpp/custom_search.py @ 442:6c182ceb7147

Fixing #217; upgrade TinyMCE to 3.4.2 and enable the paste plugin.
author Brian Neal <bgneal@gmail.com>
date Thu, 26 May 2011 00:43:49 +0000
parents 524fd1b3919a
children b910cc1460c8
rev   line source
bgneal@415 1 """
bgneal@415 2 This module contains custom code to tailor the Haystack search application to
bgneal@415 3 our needs.
bgneal@415 4
bgneal@415 5 """
bgneal@415 6 import urllib
bgneal@415 7
bgneal@415 8 from django import forms
bgneal@415 9 from haystack.forms import ModelSearchForm
bgneal@415 10
bgneal@415 11
bgneal@415 12 MODEL_CHOICES = (
bgneal@415 13 ('forums.topic', 'Forum Topics'),
bgneal@415 14 ('forums.post', 'Forum Posts'),
bgneal@415 15 ('news.story', 'News Stories'),
bgneal@415 16 ('bio.userprofile', 'User Profiles'),
bgneal@415 17 ('weblinks.link', 'Links'),
bgneal@415 18 ('downloads.download', 'Downloads'),
bgneal@415 19 ('podcast.item', 'Podcasts'),
bgneal@415 20 ('ygroup.post', 'Yahoo Group Archives'),
bgneal@415 21 )
bgneal@415 22
bgneal@415 23
bgneal@415 24 class CustomModelSearchForm(ModelSearchForm):
bgneal@415 25 """
bgneal@415 26 This customized ModelSearchForm allows us to explictly label and order
bgneal@415 27 the model choices.
bgneal@415 28
bgneal@415 29 """
bgneal@415 30 q = forms.CharField(required=False, label='',
bgneal@415 31 widget=forms.TextInput(attrs={'class': 'text', 'size': 48}))
bgneal@415 32
bgneal@415 33 def __init__(self, *args, **kwargs):
bgneal@415 34 super(CustomModelSearchForm, self).__init__(*args, **kwargs)
bgneal@415 35 self.fields['models'] = forms.MultipleChoiceField(choices=MODEL_CHOICES,
bgneal@415 36 label='', widget=forms.CheckboxSelectMultiple)