comparison gpp/downloads/forms.py @ 312:88b2b9cb8c1f

Fixing #142; cut over to the django.contrib.staticfiles app.
author Brian Neal <bgneal@gmail.com>
date Thu, 27 Jan 2011 02:56:10 +0000
parents 27bee3ac85e6
children
comparison
equal deleted inserted replaced
311:b1c39788e511 312:88b2b9cb8c1f
10 from downloads.models import AllowedExtension 10 from downloads.models import AllowedExtension
11 11
12 12
13 class AddDownloadForm(forms.ModelForm): 13 class AddDownloadForm(forms.ModelForm):
14 """Form to allow adding downloads.""" 14 """Form to allow adding downloads."""
15 title = forms.CharField(required=True, 15 title = forms.CharField(required=True,
16 widget=forms.TextInput(attrs={'size': 64, 'maxlength': 64})) 16 widget=forms.TextInput(attrs={'size': 64, 'maxlength': 64}))
17 description = forms.CharField(required=False, 17 description = forms.CharField(required=False,
18 widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) 18 widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'}))
19 19
20 def clean_file(self): 20 def clean_file(self):
21 file = self.cleaned_data['file'] 21 file = self.cleaned_data['file']
22 ext = os.path.splitext(file.name)[1] 22 ext = os.path.splitext(file.name)[1]
26 raise forms.ValidationError('The file extension "%s" is not allowed.' % ext) 26 raise forms.ValidationError('The file extension "%s" is not allowed.' % ext)
27 27
28 class Meta: 28 class Meta:
29 model = PendingDownload 29 model = PendingDownload
30 fields = ('title', 'category', 'description', 'file') 30 fields = ('title', 'category', 'description', 'file')
31 31
32 class Media: 32 class Media:
33 css = { 33 css = {
34 'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] + 34 'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] +
35 settings.GPP_THIRD_PARTY_CSS['jquery-ui']) 35 settings.GPP_THIRD_PARTY_CSS['jquery-ui'])
36 } 36 }