1. Curtis Maloney
  2. gnocchi-blog

Commits

funkybob  committed 5e4fa88

Use a modelform for comment

  • Participants
  • Parent commits 98f5f33
  • Branches default

Comments (0)

Files changed (1)

File gnocchi_blog/forms.py

View file
             data['tags'] = list(tags)
         return data
 
-class CommentForm(recaptcha.RecaptchaForm):
-    user_name = forms.CharField(max_length=50)
-    user_email = forms.EmailField()
-    content = forms.CharField(widget=forms.TextArea)
+class CommentForm(recaptcha.BaseRecaptchaForm, forms.ModelForm):
     captcha = recaptcha.RecaptchaField()
     class Meta:
         model = models.Comment
-        exclude = (
-            'post_date',
-            'ip_address',
-            'user',
-            'is_public',
-            'is_removed',
-            'post',
+        fields = (
+            'user_name',
+            'user_email',
+            'content',
         )