Ticket #2228: better_comments3.diff
File better_comments3.diff, 4.2 KB (added by , 16 years ago) |
---|
-
django/contrib/comments/admin.py
18 18 class FreeCommentAdmin(admin.ModelAdmin): 19 19 fieldsets = ( 20 20 (None, {'fields': ('content_type', 'object_id', 'site')}), 21 ('Content', {'fields': ('person_name', ' comment')}),21 ('Content', {'fields': ('person_name', 'person_email', 'person_url', 'comment')}), 22 22 ('Meta', {'fields': ('is_public', 'ip_address', 'approved')}), 23 23 ) 24 24 list_display = ('person_name', 'submit_date', 'content_type', 'get_content_object') -
django/contrib/comments/models.py
164 164 object_id = models.IntegerField(_('object ID')) 165 165 comment = models.TextField(_('comment'), max_length=3000) 166 166 person_name = models.CharField(_("person's name"), max_length=50) 167 person_email = models.EmailField(_("person's e-mail address"), blank=True) 168 person_url = models.URLField(_("person's url"), blank=True) 167 169 submit_date = models.DateTimeField(_('date/time submitted'), auto_now_add=True) 168 170 is_public = models.BooleanField(_('is public')) 169 171 ip_address = models.IPAddressField(_('ip address')) -
django/contrib/comments/views/comments.py
172 172 self.fields = ( 173 173 oldforms.TextField(field_name="person_name", max_length=50, is_required=True, 174 174 validator_list=[self.hasNoProfanities]), 175 oldforms.TextField(field_name="person_email", maxlength=70), 176 oldforms.TextField(field_name="person_url", maxlength=100), 175 177 oldforms.LargeTextField(field_name="comment", max_length=3000, is_required=True, 176 178 validator_list=[self.hasNoProfanities]), 177 179 ) … … 185 187 "Helper function" 186 188 return FreeComment(None, new_data["content_type_id"], 187 189 new_data["object_id"], new_data["comment"].strip(), 188 new_data["person_name"].strip(), datetime.datetime.now(), new_data["is_public"], 190 new_data["person_name"].strip(), 191 new_data["person_email"].strip(), 192 new_data["person_url"].strip(), 193 datetime.datetime.now(), 194 new_data["is_public"], 189 195 new_data["ip_address"], False, settings.SITE_ID) 190 196 191 197 def save(self, new_data): … … 196 202 # the comment was posted successfully. 197 203 for old_comment in FreeComment.objects.filter(content_type__id__exact=new_data["content_type_id"], 198 204 object_id__exact=new_data["object_id"], person_name__exact=new_data["person_name"], 205 person_email__exact=new_data["person_email"], person_url__exact=new_data["person_url"], 199 206 submit_date__year=today.year, submit_date__month=today.month, 200 207 submit_date__day=today.day): 201 208 if old_comment.comment == c.comment: -
django/contrib/comments/templates/comments/freeform.html
2 2 {% if display_form %} 3 3 <form action="/comments/postfree/" method="post"> 4 4 <p><label for="id_person_name">{% trans "Your name:" %}</label> <input type="text" id="id_person_name" name="person_name" /></p> 5 <p><label for="id_person_email">{% trans "E-mail Address (optional):" %}</label> <input type="text" id="id_person_email" name="person_email" /></p> 6 <p><label for="id_person_url">{% trans "URL (optional):" %}</label> <input type="text" id="id_person_url" name="person_url" /></p> 5 7 <p><label for="id_comment">{% trans "Comment:" %}</label><br /><textarea name="comment" id="id_comment" rows="10" cols="60"></textarea></p> 6 8 <p> 7 9 <input type="hidden" name="options" value="{{ options }}" />