From 113918f3a073e94a4f9b6dce25c30a71658e63b9 Mon Sep 17 00:00:00 2001 From: CruiseDevice Date: Wed, 24 Oct 2018 16:57:21 +0530 Subject: create custom_filter for vacant_slot --- sbhs/templatetags/custom_filter.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sbhs/templatetags/custom_filter.py b/sbhs/templatetags/custom_filter.py index 17ab4cc..77f7cba 100644 --- a/sbhs/templatetags/custom_filter.py +++ b/sbhs/templatetags/custom_filter.py @@ -12,4 +12,14 @@ def compare_slot_time(start_time, end_time, now): slot ="pending" else: slot = "finished" - return slot \ No newline at end of file + return slot + + +@register.simple_tag +def vacant_slot(start_time, end_time, now): + slot = "vacant" + if start_time <= now <= end_time: + slot ="occupied" + elif start_time >= now: + slot ="vacant" + return slot -- cgit