Ticket #2228: better_comments.diff
File better_comments.diff, 3.9 KB (added by , 18 years ago) |
---|
-
django/contrib/comments/models.py
166 166 object_id = models.IntegerField(_('object ID')) 167 167 comment = models.TextField(_('comment'), maxlength=3000) 168 168 person_name = models.CharField(_("person's name"), maxlength=50) 169 person_email = models.EmailField(_("person's e-mail address"), blank=True) 170 person_url = models.URLField(_("person's url"), blank=True) 169 171 submit_date = models.DateTimeField(_('date/time submitted'), auto_now_add=True) 170 172 is_public = models.BooleanField(_('is public')) 171 173 ip_address = models.IPAddressField(_('ip address')) … … 179 181 class Admin: 180 182 fields = ( 181 183 (None, {'fields': ('content_type', 'object_id', 'site')}), 182 ('Content', {'fields': ('person_name', ' comment')}),184 ('Content', {'fields': ('person_name', 'person_email', 'person_url', 'comment')}), 183 185 ('Meta', {'fields': ('submit_date', 'is_public', 'ip_address', 'approved')}), 184 186 ) 185 187 list_display = ('person_name', 'submit_date', 'content_type', 'get_content_object') -
django/contrib/comments/views/comments.py
124 124 self.fields = ( 125 125 forms.TextField(field_name="person_name", maxlength=50, is_required=True, 126 126 validator_list=[self.hasNoProfanities]), 127 forms.TextField(field_name="person_email", maxlength=70), 128 forms.TextField(field_name="person_url", maxlength=100), 127 129 forms.LargeTextField(field_name="comment", maxlength=3000, is_required=True, 128 130 validator_list=[self.hasNoProfanities]), 129 131 ) … … 137 139 "Helper function" 138 140 return FreeComment(None, new_data["content_type_id"], 139 141 new_data["object_id"], new_data["comment"].strip(), 140 new_data["person_name"].strip(), datetime.datetime.now(), new_data["is_public"], 142 new_data["person_name"].strip(), 143 new_data["person_email"].strip(), 144 new_data["person_url"].strip(), 145 datetime.datetime.now(), 146 new_data["is_public"], 141 147 new_data["ip_address"], False, settings.SITE_ID) 142 148 143 149 def save(self, new_data): … … 148 154 # the comment was posted successfully. 149 155 for old_comment in FreeComment.objects.filter(content_type__id__exact=new_data["content_type_id"], 150 156 object_id__exact=new_data["object_id"], person_name__exact=new_data["person_name"], 157 person_email__exact=new_data["person_email"], person_url__exact=new_data["person_url"], 151 158 submit_date__year=today.year, submit_date__month=today.month, 152 159 submit_date__day=today.day): 153 160 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>{% trans "Your name:" %} <input type="text" id="id_person_name" name="person_name" /></p> 5 <p>{% trans "E-mail Address (optional):" %} <input type="text" id="id_person_email" name="person_email" /></p> 6 <p>{% trans "URL (optional):" %} <input type="text" id="id_person_url" name="person_url" /></p> 5 7 <p>{% trans "Comment:" %}<br /><textarea name="comment" id="id_comment" rows="10" cols="60"></textarea></p> 6 8 <input type="hidden" name="options" value="{{ options }}" /> 7 9 <input type="hidden" name="target" value="{{ target }}" />