Coverage for cookbook/helper/HelperFunctions.py: 88%

8 statements  

« prev     ^ index     » next       coverage.py v7.4.0, created at 2023-12-29 01:02 +0100

1from django.db.models import Func 

2 

3 

4class Round(Func): 

5 function = 'ROUND' 

6 template = '%(function)s(%(expressions)s, 0)' 

7 

8 

9def str2bool(v): 

10 if isinstance(v, bool) or v is None: 

11 return v 

12 else: 

13 return v.lower() in ("yes", "true", "1")