def user_has_group_trainer(user): return user.groups.filter(name='Trainer').exists() def user_has_group_gymnast(user): return user.groups.filter(name='Gymnast').exists()