Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 6. Gym Session
- @classmethod
- def get_long_and_hard_exercises(cls):
- query = Q(duration_minutes__gt=30) & Q(difficulty_level__gte=10)
- return cls.objects.filter(query)
- @classmethod
- def get_short_and_easy_exercises(cls):
- query = Q(duration_minutes__lt=15) & Q(difficulty_level__lt=5)
- return cls.objects.filter(query)
- @classmethod
- def get_exercises_within_duration(cls, min_duration: int, max_duration: int):
- return cls.objects.filer(duration_minutes__range(min_duration, max_duration))
- @classmethod
- def get_exercises_with_difficulty_and_repetitions(min_difficulty: int, min_repetitions: int):
- return cls.objects.filter(difficulty_level__gte=min_difficulty, repetitions__gte=min_repetitions)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement