comparison gpp/news/forms.py @ 240:1246a4f1ab4f

For #93: fix url scheme for the news application.
author Brian Neal <bgneal@gmail.com>
date Wed, 15 Sep 2010 00:14:54 +0000
parents 6dbb8faef085
children 88b2b9cb8c1f
comparison
equal deleted inserted replaced
239:dcc929973bba 240:1246a4f1ab4f
21 21
22 class Media: 22 class Media:
23 js = settings.GPP_THIRD_PARTY_JS['tiny_mce'] 23 js = settings.GPP_THIRD_PARTY_JS['tiny_mce']
24 24
25 25
26 class SearchNewsForm(forms.Form):
27 """Form for a user to search news stories."""
28 text = forms.CharField(max_length=30)
29 category = forms.ModelChoiceField(label='',
30 required=False,
31 empty_label='(All Categories)',
32 queryset=Category.objects.all())
33
34 def get_query(self):
35 return self.cleaned_data['text']
36
37 def get_category(self):
38 cat = self.cleaned_data['category']
39 if cat:
40 return cat
41 return None
42
43
44 class SendStoryForm(forms.Form): 26 class SendStoryForm(forms.Form):
45 """Form for sending a news story via email to a friend.""" 27 """Form for sending a news story via email to a friend."""
46 friend_name = forms.CharField(label="Friend's Name", max_length=64) 28 friend_name = forms.CharField(label="Friend's Name", max_length=64)
47 friend_email = forms.EmailField(label="Friend's Email") 29 friend_email = forms.EmailField(label="Friend's Email")
48 30