annotate apps/treecomments/forms.py @ 196:134f726fd62c

Removed extrawhitespaces and moved comments template files to templates folder
author Ahsan Ali Shahid <ahsan.ali.shahid@gmail.com>
date Thu, 04 Jul 2013 15:45:50 +0500
parents 50ba20441122
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
194
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
1 from django import forms
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
2 from django.contrib.admin import widgets
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
3 from django.contrib.comments.forms import CommentForm
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
4 from apps.treecomments.models import TreeComments
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
5
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
6 class TreeCommentsForm(CommentForm):
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
7 parent = forms.ModelChoiceField(queryset=TreeComments.objects.all(), required=False, widget=forms.HiddenInput)
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
8 def get_comment_model(self):
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
9 return TreeComments
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
10 def get_comment_create_data(self):
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
11 data = super(TreeCommentsForm,self).get_comment_create_data()
50ba20441122 Added comment template files and customized comments app files
ahsanalishahid <ahsan.ali.shahid@gmail.com>
parents:
diff changeset
12 data['parent'] = self.cleaned_data['parent']
196
134f726fd62c Removed extrawhitespaces and moved comments template files to templates folder
Ahsan Ali Shahid <ahsan.ali.shahid@gmail.com>
parents: 194
diff changeset
13 return data