def unblock(form): by = User.find_by('username', form['stalker']) blocked = User.find_by('username', form['victim']) unblock = Block.find_both('by_id', by.getId(), 'blocked_id', blocked.getId()) unblock.delete() return redirect(url_for('profile', username=form['victim']))
def create_if(self, infos, stalker_id): if Block.find_both('by_id', infos['user_id'], 'blocked_id', stalker_id) == None: return self.create(infos) pass