def make_films(uc_model): json_movies = MoviesPicture.get_movies() for comment in uc_model.comments_list: for film in json_movies: if int(comment.movie_id) == int(film["id"]): uc_model.movie = film json_array = RankList(uc_model) json_file = open("user_comment.json", 'r+') json_file.write(json.dumps(json_array.to_json())) json_file.close()
def model_to_json(self): json_array = RankList(self.mc_models_array) json_file = open("rank_comments.json", 'r+') json_file.write(json.dumps(json_array.to_json())) json_file.close()