From 3038c1d09f5d56e7ac1c169ce49c40e111fd33e1 Mon Sep 17 00:00:00 2001 From: Willem Van Onsem Date: Wed, 11 Jan 2023 01:48:13 +0100 Subject: [PATCH] use repr for attribute values, fixing #50 --- rest_framework_ccbv/inspector.py | 4 ++++ templates/detail_view.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rest_framework_ccbv/inspector.py b/rest_framework_ccbv/inspector.py index e1d2e9f..f4e498d 100644 --- a/rest_framework_ccbv/inspector.py +++ b/rest_framework_ccbv/inspector.py @@ -60,6 +60,10 @@ def __init__(self, name, value, classobject, instance_class): self.instance_class = instance_class self.dirty = False + @property + def repr_value(self): + return repr(self.value) + def __eq__(self, obj): return self.name == obj.name and self.value == obj.value diff --git a/templates/detail_view.html b/templates/detail_view.html index e8c68e9..7f75926 100644 --- a/templates/detail_view.html +++ b/templates/detail_view.html @@ -110,7 +110,7 @@

Attributes

- {{ attribute.name }} = {{ attribute.value|e }} + {{ attribute.name }} = {{ attribute.repr_value|e }}