diff --git a/smash/web/models/study.py b/smash/web/models/study.py index 4501a3be57d712de4cb3f35cf77eae8a9407c67a..bfff2a6e067dd09fdb9803f4a261ec57c5412547 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