gremmie@1: """ gremmie@1: Forms for the news application. gremmie@1: """ gremmie@1: gremmie@1: from django import forms bgneal@7: from django.conf import settings bgneal@7: gremmie@1: from news.models import PendingStory gremmie@1: from news.models import Category gremmie@1: gremmie@1: gremmie@1: class AddNewsForm(forms.ModelForm): gremmie@1: """Form for a user to submit a news story to the admins for review.""" gremmie@1: title = forms.CharField(widget=forms.TextInput(attrs={'size': 52})) gremmie@1: short_text = forms.CharField(widget=forms.Textarea(attrs={'rows': 20, 'cols': 80})) gremmie@1: long_text = forms.CharField(required=False, widget=forms.Textarea(attrs={'rows': 20, 'cols': 80})) gremmie@1: gremmie@1: class Meta: gremmie@1: model = PendingStory bgneal@218: fields = ('title', 'category', 'short_text', 'long_text') gremmie@1: gremmie@1: class Media: bgneal@7: js = settings.GPP_THIRD_PARTY_JS['tiny_mce'] gremmie@1: gremmie@1: gremmie@1: class SendStoryForm(forms.Form): gremmie@1: """Form for sending a news story via email to a friend.""" gremmie@1: friend_name = forms.CharField(label="Friend's Name", max_length=64) gremmie@1: friend_email = forms.EmailField(label="Friend's Email") gremmie@1: gremmie@1: def email(self): gremmie@1: return self.cleaned_data['friend_email'] gremmie@1: gremmie@1: def name(self): gremmie@1: return self.cleaned_data['friend_name'] gremmie@1: