Ticket #10838: comments.diff
File comments.diff, 2.1 KB (added by , 16 years ago) |
---|
-
django/contrib/comments/templatetags/comments.py
123 123 124 124 def get_form(self, context): 125 125 ctype, object_pk = self.get_target_ctype_pk(context) 126 user = context.get('user', None) 126 127 if object_pk: 127 return comments.get_form()(ctype.get_object_for_this_type(pk=object_pk) )128 return comments.get_form()(ctype.get_object_for_this_type(pk=object_pk), user=user) 128 129 else: 129 130 return None 130 131 -
django/contrib/comments/views/comments.py
61 61 preview = "preview" in data 62 62 63 63 # Construct the comment form 64 form = comments.get_form()(target, data=data )64 form = comments.get_form()(target, data=data, user=request.user) 65 65 66 66 # Check security information 67 67 if form.security_errors(): -
django/contrib/comments/forms.py
96 96 comment = forms.CharField(label=_('Comment'), widget=forms.Textarea, 97 97 max_length=COMMENT_MAX_LENGTH) 98 98 99 def __init__(self, target_object, data=None, initial=None, user=None): 100 self.user = user 101 if initial is None: 102 initial = {} 103 if user and user.is_authenticated(): 104 initial.update({"name":user.get_full_name() or user.username, 105 "email":user.email}) 106 super(CommentDetailsForm, self).__init__(target_object, data=data, initial=initial) 107 99 108 def get_comment_object(self): 100 109 """ 101 110 Return a new (unsaved) comment object based on the information in this