Mercurial > public > sg101
comparison gpp/downloads/forms.py @ 133:c515b7401078
Use the new common way to apply markItUp to textareas and to get the smiley and markdown help dialogs for all the remaining apps except for forums and comments.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 27 Nov 2009 00:21:47 +0000 |
parents | f408971657b9 |
children | b4305e18d3af |
comparison
equal
deleted
inserted
replaced
132:06503edcc56b | 133:c515b7401078 |
---|---|
18 return self.cleaned_data['text'] | 18 return self.cleaned_data['text'] |
19 | 19 |
20 | 20 |
21 class AddDownloadForm(forms.ModelForm): | 21 class AddDownloadForm(forms.ModelForm): |
22 """Form to allow adding downloads.""" | 22 """Form to allow adding downloads.""" |
23 title = forms.CharField(required=True, | |
24 widget=forms.TextInput(attrs={'size': 64, 'maxlength': 64})) | |
25 description = forms.CharField(required=False, | |
26 widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) | |
23 | 27 |
24 def clean_file(self): | 28 def clean_file(self): |
25 file = self.cleaned_data['file'] | 29 file = self.cleaned_data['file'] |
26 ext = os.path.splitext(file.name)[1] | 30 ext = os.path.splitext(file.name)[1] |
27 allowed_exts = AllowedExtension.objects.get_extension_list() | 31 allowed_exts = AllowedExtension.objects.get_extension_list() |
33 model = Download | 37 model = Download |
34 fields = ('title', 'category', 'description', 'file') | 38 fields = ('title', 'category', 'description', 'file') |
35 | 39 |
36 class Media: | 40 class Media: |
37 css = { | 41 css = { |
38 'all': settings.GPP_THIRD_PARTY_CSS['markitup'], | 42 'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] + |
43 settings.GPP_THIRD_PARTY_CSS['jquery-ui']) | |
39 } | 44 } |
40 js = settings.GPP_THIRD_PARTY_JS['markitup'] + \ | 45 js = (settings.GPP_THIRD_PARTY_JS['markitup'] + |
41 ('js/downloads/add.js', ) | 46 settings.GPP_THIRD_PARTY_JS['jquery-ui']) |
42 |