comparison gpp/forums/forms.py @ 106:cb72577785df

Forums: implemented the edit post function.
author Brian Neal <bgneal@gmail.com>
date Sat, 19 Sep 2009 21:49:56 +0000
parents e67c4dd98db5
children 80ab249d1adc
comparison
equal deleted inserted replaced
105:08ddfd835305 106:cb72577785df
15 profile = user.get_profile() 15 profile = user.get_profile()
16 profile.forum_post_count += 1 16 profile.forum_post_count += 1
17 profile.save() 17 profile.save()
18 18
19 19
20 class PostForm(forms.Form): 20 class NewPostForm(forms.Form):
21 """Form for creating a new post.""" 21 """Form for creating a new post."""
22 body = forms.CharField(label='', widget=forms.Textarea) 22 body = forms.CharField(label='', widget=forms.Textarea)
23 topic_id = forms.IntegerField(widget=forms.HiddenInput) 23 topic_id = forms.IntegerField(widget=forms.HiddenInput)
24 topic = None 24 topic = None
25 25
97 user_ip=ip) 97 user_ip=ip)
98 post.save() 98 post.save()
99 99
100 bump_post_count(self.user) 100 bump_post_count(self.user)
101 return topic 101 return topic
102
103
104 class PostForm(forms.ModelForm):
105 """
106 Form for editing an existing post.
107 """
108 body = forms.CharField(label='', widget=forms.Textarea)
109
110 class Meta:
111 model = Post
112 fields = ('body', )
113
114 class Media:
115 css = {
116 'all': settings.GPP_THIRD_PARTY_CSS['markitup'],
117 }
118 js = settings.GPP_THIRD_PARTY_JS['markitup'] + \
119 ('js/forums.js', )