aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/register/models.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-19 17:11:19 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-19 17:11:19 +0100
commitc07178fb19f55ea8354b2de153a2d41c66d58f32 (patch)
tree68c6e3f87a349fe7077e037fafdcaa1a7d9c79df /ctrack/register/models.py
parentd8a07a2157c627c51a5dce963a92be87baf7c31d (diff)
started writing the code for the note event
Diffstat (limited to '')
-rw-r--r--ctrack/register/models.py25
1 files changed, 19 insertions, 6 deletions
diff --git a/ctrack/register/models.py b/ctrack/register/models.py
index 45ee99e..0c88a54 100644
--- a/ctrack/register/models.py
+++ b/ctrack/register/models.py
@@ -17,7 +17,6 @@ class EventType(Enum):
PHONE_CALL = auto()
VIDEO_CALL = auto()
EMAIL = auto()
- NOTE = auto()
# single date caf events
CAF_INITIAL_CAF_RECEIVED = auto()
CAF_FEEDBACK_EMAILED_OES = auto()
@@ -88,7 +87,9 @@ class EventBase(AuditableEventBase):
class ThirdPartyEventMixin(models.Model):
- participants = models.ManyToManyField(Person, blank=False)
+ participants = models.ManyToManyField(
+ Person, blank=False
+ ) # cannot enforce this at DB level
location = models.CharField(
max_length=100,
blank=True,
@@ -160,15 +161,28 @@ class ResponseRequiredMixin(models.Model):
class PrivateEventMixin(models.Model):
private = models.BooleanField(
- default=False, help_text="Private events can only be seen by you. Official records should "
- "not be private, but you can use private events to track your own "
- "work."
+ default=False,
+ help_text="Private events can only be seen by you. Official records should "
+ "not be private, but you can use private events to track your own "
+ "work.",
)
class Meta:
abstract = True
+class NoteEvent(
+ EventBase,
+ ResponseRequiredMixin,
+ URLEventMixin,
+ PrivateEventMixin,
+):
+ type_descriptor = models.CharField(blank=False, max_length=50, default="NOTE")
+ organisation = models.ForeignKey(
+ "organisations.Organisation", on_delete=models.CASCADE, blank=False
+ )
+
+
class SingleDateTimeEvent(
EventBase,
ResponseRequiredMixin,
@@ -182,7 +196,6 @@ class SingleDateTimeEvent(
(EventType.PHONE_CALL.name, "Phone Call"),
(EventType.VIDEO_CALL.name, "Video Call"),
(EventType.EMAIL.name, "Email"),
- (EventType.NOTE.name, "Note"),
]
type_descriptor = models.CharField(
blank=False, max_length=50, choices=AVAILABLE_TYPES, verbose_name="Event Type"