How to display comments sorted by date added?
There is a model, a view and a template
Django Charles Dixon, May 6, 2019
1 AnswersChange this line in views.py
args['comments'] = Comment.objects.filter(comment_product_id=product_slug)
date_from = datetime.datetime.now() - datetime.timedelta(days=1)
args['comments'] = Comment.objects.filter(comment_product_id=product_slug, comment_created_at__gte=date_from).order_by('comment_created_at')
And don't forget to
I typed the code right away in the browser without testing, so there may be errorsAnonymous
Your AnswerTo place the code, please use CodePen or similar tool. Thanks you!