def vote_up(this_record):
    if already_voted_for(this_record):
        return (
            """<script type="text/javascript">
                       alert('You can only vote once');
            </script>{0}"""
            .format(count_votes_for(this_record)))
vandalisms.update({'_id': bson.objectid.ObjectId(this_record)}, {'$inc': {
    'votes': 1}}, upsert=True)
AJAX for updating Flask template after data goes from link action or form to mongodb collection