def follow(user): """ Controller for following a user """ try: User.objects(username=session['username']).update_one(add_to_set__following=user) return redirect('/u/%s' % user) except: return 'fail'
def subscribe(tag): """ Controller for subscribing to tags """ try: User.objects(username=session['username']).update_one(add_to_set__subscriptions=tag) return redirect('/tags/%s' % tag) except: return 'fail'
def subscribe(tag): """ Controller for subscribing to tags """ try: User.objects(username=session['username']).update_one( add_to_set__subscriptions=tag) return redirect('/tags/%s' % tag) except: return 'fail'
def follow(user): """ Controller for following a user """ try: User.objects(username=session['username']).update_one( add_to_set__following=user) return redirect('/u/%s' % user) except: return 'fail'