def love_work(work_id): check_login() tags = request.form['tags'].split(' ') # remove the empty & repeat item new_tags = [] for t in tags: if t != '': new_tags.append(t) new_tags = list(set(new_tags)) # add love work is_loved = Love_work.check_love(session['user_id'], work_id) if is_loved: Love_work.edit(session['user_id'], work_id, ' '.join(new_tags) + ' ') else: Love_work.add(session['user_id'], work_id, ' '.join(new_tags) + ' ') # update user tags & work tags for t in new_tags: Tag.add_tag(t) Tag.add_user_tag(session['user_id'], t) Tag.add_work_tag(work_id, t) return redirect(url_for('single_work', work_id=work_id))
def love_work(work_id): check_login() tags = request.form['tags'].split(' ') # remove the empty & repeat item new_tags = [] for t in tags: if t != '': new_tags.append(t) new_tags = list(set(new_tags)) # add love work is_loved = Love_work.check_love(session['user_id'], work_id) if is_loved: Love_work.edit(session['user_id'], work_id, ' '.join(new_tags) + ' ') else: Love_work.add(session['user_id'], work_id, ' '.join(new_tags) + ' ') # update user tags & work tags for t in new_tags: Tag.add_tag(t) Tag.add_user_tag(session['user_id'], t) Tag.add_work_tag(work_id, t) return redirect(url_for('single_work', work_id=work_id))
def collect_work(work_id): tags = request.form['tags'].split(' ') # remove the empty & repeat item new_tags = [] for t in tags: if t != '': new_tags.append(t) new_tags = list(set(new_tags)) # collect work Collect.add(session['user_id'], work_id, ' '.join(new_tags) + ' ') # update user tags & work tags for t in new_tags: Tag.add_tag(t) Tag.add_user_tag(session['user_id'], t) Tag.add_work_tag(work_id, t) return redirect(url_for('single_work', work_id=work_id))
def collect_work(work_id): tags = request.form['tags'].split(' ') # remove the empty & repeat item new_tags = [] for t in tags: if t != '': new_tags.append(t) new_tags = list(set(new_tags)) # collect work Collect.add(session['user_id'], work_id, ' '.join(new_tags) + ' ') # update user tags & work tags for t in new_tags: Tag.add_tag(t) Tag.add_user_tag(session['user_id'], t) Tag.add_work_tag(work_id, t) return redirect(url_for('single_work', work_id=work_id))