Code

Ticket #16296: comment_order.patch

File comment_order.patch, 777 bytes (added by FunkyBob, 3 years ago)
  • models.py

     
    1010from django.conf import settings 
    1111 
    1212COMMENT_MAX_LENGTH = getattr(settings,'COMMENT_MAX_LENGTH',3000) 
     13COMMENTS_ORDERING = getattr(settings, 'COMMENTS_ORDERING', ('submit_date',)) 
     14if COMMENTS_ODERING = 'reverse': 
     15    COMMENTS_ORDERING = ('-submit_date') 
    1316 
    1417class BaseCommentAbstractModel(models.Model): 
    1518    """ 
     
    7174 
    7275    class Meta: 
    7376        db_table = "django_comments" 
    74         ordering = ('submit_date',) 
     77        ordering = COMMENTS_ORDERING 
    7578        permissions = [("can_moderate", "Can moderate comments")] 
    7679        verbose_name = _('comment') 
    7780        verbose_name_plural = _('comments')