Ticket #10633: comments-models.diff
File comments-models.diff, 2.7 KB (added by , 16 years ago) |
---|
-
django/contrib/comments/models.py
19 19 20 20 # Content-object field 21 21 content_type = models.ForeignKey(ContentType, 22 verbose_name=_('content type'), 22 23 related_name="content_type_set_for_%(class)s") 23 24 object_pk = models.TextField(_('object ID')) 24 25 content_object = generic.GenericForeignKey(ct_field="content_type", fk_field="object_pk") … … 46 47 # Who posted this comment? If ``user`` is set then it was an authenticated 47 48 # user; otherwise at least user_name should have been set and the comment 48 49 # 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") 50 52 user_name = models.CharField(_("user's name"), max_length=50, blank=True) 51 53 user_email = models.EmailField(_("user's email address"), blank=True) 52 54 user_url = models.URLField(_("user's URL"), blank=True) … … 71 73 db_table = "django_comments" 72 74 ordering = ('submit_date',) 73 75 permissions = [("can_moderate", "Can moderate comments")] 76 verbose_name = _('comment') 77 verbose_name_plural = _('comments') 74 78 75 79 def __unicode__(self): 76 80 return "%s: %s..." % (self.name, self.comment[:50]) … … 161 165 design users are only allowed to flag a comment with a given flag once; 162 166 if you want rating look elsewhere. 163 167 """ 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) 168 172 169 173 # Constants for flag types 170 174 SUGGEST_REMOVAL = "removal suggestion" … … 174 178 class Meta: 175 179 db_table = 'django_comment_flags' 176 180 unique_together = [('user', 'comment', 'flag')] 181 verbose_name = _('comment flag') 182 verbose_name_plural = _('comment flags') 177 183 178 184 def __unicode__(self): 179 185 return "%s flag of comment ID %s by %s" % \