def get_char_times(char_id): try: board = MongoPlunderBoard.objects.get(id=char_id) except DoesNotExist: board = MongoPlunderBoard(id=char_id) board.times = 0 board.save() return board.times
def incr(char_id, times=1): try: board = MongoPlunderBoard.objects.get(id=char_id) except DoesNotExist: board = MongoPlunderBoard(id=char_id) board.times = 0 board.times += times board.save()