Ticket #2228: better_comments3.diff

File better_comments3.diff, 4.2 KB (added by Bjorn Kristinsson, 16 years ago)

Simply an update of the diff file for more recent releases.

  • django/contrib/comments/admin.py

     
    1818class FreeCommentAdmin(admin.ModelAdmin):
    1919    fieldsets = (
    2020        (None, {'fields': ('content_type', 'object_id', 'site')}),
    21         ('Content', {'fields': ('person_name', 'comment')}),
     21        ('Content', {'fields': ('person_name', 'person_email', 'person_url', 'comment')}),
    2222        ('Meta', {'fields': ('is_public', 'ip_address', 'approved')}),
    2323    )
    2424    list_display = ('person_name', 'submit_date', 'content_type', 'get_content_object')
  • django/contrib/comments/models.py

     
    164164    object_id = models.IntegerField(_('object ID'))
    165165    comment = models.TextField(_('comment'), max_length=3000)
    166166    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)   
    167169    submit_date = models.DateTimeField(_('date/time submitted'), auto_now_add=True)
    168170    is_public = models.BooleanField(_('is public'))
    169171    ip_address = models.IPAddressField(_('ip address'))
  • django/contrib/comments/views/comments.py

     
    172172        self.fields = (
    173173            oldforms.TextField(field_name="person_name", max_length=50, is_required=True,
    174174                validator_list=[self.hasNoProfanities]),
     175            oldforms.TextField(field_name="person_email", maxlength=70),
     176            oldforms.TextField(field_name="person_url", maxlength=100),
    175177            oldforms.LargeTextField(field_name="comment", max_length=3000, is_required=True,
    176178                validator_list=[self.hasNoProfanities]),
    177179        )
     
    185187        "Helper function"
    186188        return FreeComment(None, new_data["content_type_id"],
    187189            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"],
    189195            new_data["ip_address"], False, settings.SITE_ID)
    190196
    191197    def save(self, new_data):
     
    196202        # the comment was posted successfully.
    197203        for old_comment in FreeComment.objects.filter(content_type__id__exact=new_data["content_type_id"],
    198204            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"],
    199206            submit_date__year=today.year, submit_date__month=today.month,
    200207            submit_date__day=today.day):
    201208            if old_comment.comment == c.comment:
  • django/contrib/comments/templates/comments/freeform.html

     
    22{% if display_form %}
    33<form action="/comments/postfree/" method="post">
    44<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>
    57<p><label for="id_comment">{% trans "Comment:" %}</label><br /><textarea name="comment" id="id_comment" rows="10" cols="60"></textarea></p>
    68<p>
    79<input type="hidden" name="options" value="{{ options }}" />
Back to Top