Ticket #10633: comments-models.diff

File comments-models.diff, 2.7 KB (added by Jarek Zgoda, 16 years ago)

patch to enable translations on model fields

  • django/contrib/comments/models.py

     
    1919
    2020    # Content-object field
    2121    content_type   = models.ForeignKey(ContentType,
     22            verbose_name=_('content type'),
    2223            related_name="content_type_set_for_%(class)s")
    2324    object_pk      = models.TextField(_('object ID'))
    2425    content_object = generic.GenericForeignKey(ct_field="content_type", fk_field="object_pk")
     
    4647    # Who posted this comment? If ``user`` is set then it was an authenticated
    4748    # user; otherwise at least user_name should have been set and the comment
    4849    # was posted by a non-authenticated user.
    49     user        = models.ForeignKey(User, blank=True, null=True, related_name="%(class)s_comments")
     50    user        = models.ForeignKey(User, verbose_name=_('user'),
     51                    blank=True, null=True, related_name="%(class)s_comments")
    5052    user_name   = models.CharField(_("user's name"), max_length=50, blank=True)
    5153    user_email  = models.EmailField(_("user's email address"), blank=True)
    5254    user_url    = models.URLField(_("user's URL"), blank=True)
     
    7173        db_table = "django_comments"
    7274        ordering = ('submit_date',)
    7375        permissions = [("can_moderate", "Can moderate comments")]
     76        verbose_name = _('comment')
     77        verbose_name_plural = _('comments')
    7478
    7579    def __unicode__(self):
    7680        return "%s: %s..." % (self.name, self.comment[:50])
     
    161165    design users are only allowed to flag a comment with a given flag once;
    162166    if you want rating look elsewhere.
    163167    """
    164     user      = models.ForeignKey(User, related_name="comment_flags")
    165     comment   = models.ForeignKey(Comment, related_name="flags")
    166     flag      = models.CharField(max_length=30, db_index=True)
    167     flag_date = models.DateTimeField(default=None)
     168    user      = models.ForeignKey(User, verbose_name=_('user'), related_name="comment_flags")
     169    comment   = models.ForeignKey(Comment, verbose_name=_('comment'), related_name="flags")
     170    flag      = models.CharField(_('flag'), max_length=30, db_index=True)
     171    flag_date = models.DateTimeField(_('date'), default=None)
    168172
    169173    # Constants for flag types
    170174    SUGGEST_REMOVAL = "removal suggestion"
     
    174178    class Meta:
    175179        db_table = 'django_comment_flags'
    176180        unique_together = [('user', 'comment', 'flag')]
     181        verbose_name = _('comment flag')
     182        verbose_name_plural = _('comment flags')
    177183
    178184    def __unicode__(self):
    179185        return "%s flag of comment ID %s by %s" % \
Back to Top