From 5f01a5cedb50aa37fe30eae9ab95612526a25a06 Mon Sep 17 00:00:00 2001 From: Carlos Vega <carlos.vega@uni.lu> Date: Tue, 23 Oct 2018 11:40:45 +0200 Subject: [PATCH] Issue #246 added methods to check the study voucher and voucher_type property --- smash/web/models/study.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/smash/web/models/study.py b/smash/web/models/study.py index 4501a3be..bfff2a6e 100644 --- a/smash/web/models/study.py +++ b/smash/web/models/study.py @@ -29,3 +29,19 @@ class Study(models.Model): def __unicode__(self): return "%s" % self.name + + @property + def has_voucher_types(self): + return self.columns.voucher_types + + @property + def has_vouchers(self): + return self.columns.vouchers + + @staticmethod + def get_by_id(study_id): + study = Study.objects.filter(id=study_id) + if len(study) > 0: + return study[0] + else: + return None \ No newline at end of file -- GitLab