From 5b4b3058a5f50aa020f1496f49e72a63efb0169a Mon Sep 17 00:00:00 2001 From: Kumi Date: Thu, 31 Dec 2020 22:17:46 +0100 Subject: [PATCH] Create PercentageField for use in future CBT comp --- common/fields.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 common/fields.py diff --git a/common/fields.py b/common/fields.py new file mode 100644 index 0000000..04a2e7b --- /dev/null +++ b/common/fields.py @@ -0,0 +1,5 @@ +from django.db import models +from django.core.validators import MinValueValidator, MaxValueValidator + +class PercentageField(models.FloatField): + default_validators = [MaxValueValidator(100), MinValueValidator(0)] \ No newline at end of file