Answer the question
In order to leave comments, you need to log in
One-time user action?
Hello.
I wrote my little blog with ̶ ̶b̶l̶e̶k̶d̶zh̶e̶k̶o̶m̶ ̶i̶ ̶d̶a̶m̶a̶m̶i̶ with posts and comments.
Now I want to make "pluses" to the comments, but I don't know how to implement it better.
Now the comment table looks like this:
Commentary:
id
text
author_name
id_post
@app.route('/votes/', methods=['POST'])
def create_vote():
if session.get('voted'):
return jsonify(error='Already voted.'), 401
vote = Vote(constituency_id=request.form.get('constituency_id'),
party_id=request.form.get('party_id'))
db.session.add(vote)
db.session.commit()
session['voted'] = True
return jsonify(vote)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question