diff apps/treecomments/forms.py @ 194:50ba20441122

Added comment template files and customized comments app files
author ahsanalishahid <ahsan.ali.shahid@gmail.com>
date Tue, 02 Jul 2013 02:04:09 +0500
parents
children 134f726fd62c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/apps/treecomments/forms.py	Tue Jul 02 02:04:09 2013 +0500
@@ -0,0 +1,15 @@
+from django import forms
+from django.contrib.admin import widgets
+from django.contrib.comments.forms import CommentForm
+from apps.treecomments.models import TreeComments
+
+class TreeCommentsForm(CommentForm):
+	parent = forms.ModelChoiceField(queryset=TreeComments.objects.all(), required=False, widget=forms.HiddenInput)
+	
+	def get_comment_model(self):
+		return TreeComments
+
+	def get_comment_create_data(self):
+		data = super(TreeCommentsForm,self).get_comment_create_data()
+		data['parent'] = self.cleaned_data['parent']
+		return data	
\ No newline at end of file