From 3cf694f9856617194384bca1de70fa5cc04b387c Mon Sep 17 00:00:00 2001 From: "Victor \"multun\" Collod" Date: Tue, 12 Feb 2019 17:08:20 +0100 Subject: [PATCH] Add the TODO_COMMENT_CLASSES setting --- README.md | 3 +++ todo/templates/todo/task_detail.html | 2 +- todo/views/task_detail.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e653f73..abdcd2d 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,9 @@ TODO_DEFAULT_LIST_SLUG = 'tickets' # Defaults to "/" TODO_PUBLIC_SUBMIT_REDIRECT = 'dashboard' +# additionnal classes the comment body should hold +# adding "text-monospace" makes comment monospace +TODO_COMMENT_CLASSES = [] ``` The current django-todo version number is available from the [todo package](https://github.com/shacker/django-todo/blob/master/todo/__init__.py): diff --git a/todo/templates/todo/task_detail.html b/todo/templates/todo/task_detail.html index 8452300..78ffa05 100644 --- a/todo/templates/todo/task_detail.html +++ b/todo/templates/todo/task_detail.html @@ -142,7 +142,7 @@ {{ comment.date|date:"F d Y P" }} -
+
{{ comment.body|safe|urlize|linebreaks }}
diff --git a/todo/views/task_detail.py b/todo/views/task_detail.py index 64a201e..8ded8d8 100644 --- a/todo/views/task_detail.py +++ b/todo/views/task_detail.py @@ -2,6 +2,7 @@ import bleach import datetime from django import forms +from django.conf import settings from django.contrib import messages from django.contrib.auth.decorators import login_required, user_passes_test from django.core.exceptions import PermissionDenied @@ -131,6 +132,7 @@ def task_detail(request, task_id: int) -> HttpResponse: "form": form, "merge_form": merge_form, "thedate": thedate, + "comment_classes": getattr(settings, 'TODO_COMMENT_CLASSES', []), } return render(request, "todo/task_detail.html", context)