gremmie@1: """
gremmie@1: Forms for the news application.
bgneal@493: 
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: 
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}))
bgneal@493:    short_text = forms.CharField(
bgneal@493:            label="Article text",
bgneal@493:            widget=forms.Textarea(
bgneal@493:                attrs={'rows': 60, 'cols': 80, 'style': 'height:500px'}))
gremmie@1: 
gremmie@1:    class Meta:
gremmie@1:       model = PendingStory
bgneal@493:       fields = ['title', 'category', 'short_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']
bgneal@312: 
gremmie@1:    def name(self):
gremmie@1:       return self.cleaned_data['friend_name']
gremmie@1: