Пример #1
0
def favorite_activity(action, profile, activity):
    node = Profile.objects(pk=profile).first()
    activity = Activity.objects(pk=activity).first()
    if (action == 'add'):
        RelationShips.favorite(node, activity)
    else:
        RelationShips.un_favorite(node, activity)
    return node
Пример #2
0
 def apply(self, query, value):
     activity = Activity.objects(name__icontains=value).first()
     return query.filter(activities__in=[activity.id])