annotate news/forms.py @ 693:ad69236e8501

For issue #52, update many 3rd party Javascript libraries. Updated to jquery 1.10.2, jquery ui 1.10.3. This broke a lot of stuff. - Found a newer version of the jquery cycle all plugin (3.0.3). - Updated JPlayer to 2.4.0. - Updated to MarkItUp 1.1.14. This also required me to add multiline attributes set to true on various buttons in the markdown set. - As per a stackoverflow post, added some code to get multiline titles in a jQuery UI dialog. They removed that functionality but allow you to put it back. Tweaked the MarkItUp preview CSS to show blockquotes in italic. Did not update TinyMCE at this time. I'm not using the JQuery version and this version appears to work ok for now. What I should do is make a repo for MarkItUp and do a vendor branch thing so I don't have to futz around diffing directories to figure out if I'll lose changes when I update.
author Brian Neal <bgneal@gmail.com>
date Wed, 04 Sep 2013 19:55:20 -0500
parents ee87ea74d46b
children ff645a692791
rev   line source
gremmie@1 1 """
gremmie@1 2 Forms for the news application.
bgneal@493 3
gremmie@1 4 """
gremmie@1 5 from django import forms
bgneal@7 6 from django.conf import settings
bgneal@7 7
gremmie@1 8 from news.models import PendingStory
gremmie@1 9 from news.models import Category
gremmie@1 10
gremmie@1 11
gremmie@1 12 class AddNewsForm(forms.ModelForm):
gremmie@1 13 """Form for a user to submit a news story to the admins for review."""
gremmie@1 14 title = forms.CharField(widget=forms.TextInput(attrs={'size': 52}))
bgneal@493 15 short_text = forms.CharField(
bgneal@493 16 label="Article text",
bgneal@493 17 widget=forms.Textarea(
bgneal@493 18 attrs={'rows': 60, 'cols': 80, 'style': 'height:500px'}))
gremmie@1 19
gremmie@1 20 class Meta:
gremmie@1 21 model = PendingStory
bgneal@493 22 fields = ['title', 'category', 'short_text']
gremmie@1 23
gremmie@1 24 class Media:
bgneal@7 25 js = settings.GPP_THIRD_PARTY_JS['tiny_mce']
gremmie@1 26
gremmie@1 27
gremmie@1 28 class SendStoryForm(forms.Form):
gremmie@1 29 """Form for sending a news story via email to a friend."""
gremmie@1 30 friend_name = forms.CharField(label="Friend's Name", max_length=64)
gremmie@1 31 friend_email = forms.EmailField(label="Friend's Email")
gremmie@1 32
gremmie@1 33 def email(self):
gremmie@1 34 return self.cleaned_data['friend_email']
bgneal@312 35
gremmie@1 36 def name(self):
gremmie@1 37 return self.cleaned_data['friend_name']
gremmie@1 38