From fd765dab5eab149535ec01540562e8100f582307 Mon Sep 17 00:00:00 2001 From: Jayaram R Pai Date: Tue, 8 Jul 2014 08:57:48 +0530 Subject: added emails field for comment and reply --- comments/forms.py | 2 ++ comments/models.py | 2 ++ comments/templates/comments/get_comments.html | 9 +++++++-- comments/templates/comments/new_comment.html | 4 ++++ comments/templates/comments/new_reply.html | 4 ++++ comments/views.py | 2 ++ 6 files changed, 21 insertions(+), 2 deletions(-) (limited to 'comments') diff --git a/comments/forms.py b/comments/forms.py index a5fb326..b944a49 100644 --- a/comments/forms.py +++ b/comments/forms.py @@ -7,6 +7,7 @@ class CommentForm(forms.Form): page = forms.CharField(widget=forms.HiddenInput()) title = forms.CharField() body = forms.CharField(widget=forms.Textarea) + email = forms.CharField() def clean(self): cleaned_data = self.cleaned_data @@ -19,6 +20,7 @@ class CommentForm(forms.Form): class ReplyForm(forms.Form): comment_id = forms.CharField(widget=forms.HiddenInput()) body = forms.CharField(widget=forms.Textarea) + email = forms.CharField() def clean(self): return self.cleaned_data diff --git a/comments/models.py b/comments/models.py index 390b274..0c7f70f 100644 --- a/comments/models.py +++ b/comments/models.py @@ -7,12 +7,14 @@ class Comment(models.Model): chapter = models.CharField(max_length=10) example = models.CharField(max_length=10) page = models.CharField(max_length=10) + email = models.CharField(max_length=100) date_created = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) class Reply(models.Model): comment = models.ForeignKey(Comment) body = models.CharField(max_length=200) + email = models.CharField(max_length=100) date_created = models.DateTimeField(auto_now_add=True) date_modified = models.DateTimeField(auto_now=True) diff --git a/comments/templates/comments/get_comments.html b/comments/templates/comments/get_comments.html index 5dcc84a..71443db 100644 --- a/comments/templates/comments/get_comments.html +++ b/comments/templates/comments/get_comments.html @@ -22,6 +22,7 @@
{{ comment.body }} + {{ comment.email }}
{{ reply.body }}
+ - {{ comment.email }}No comments for this example...
- Create a new comment +Be the first one to create a comment for this example.
+ + Create a new comment +{{ comment.body }} + {{ comment.email }}
{{ reply.body }}
+ - {{ reply.email }}