Esempio n. 1
0
 def post(self, movie):
     if Movies.find_by_title(movie):
         return {' Message': 'Movie with the  title {} already exists'.format(movie)}
     args = Movies_List.parser.parse_args()
     item = Movies(movie, args['director'], args['genre'], args['collection'])
     item.save_to()
     return item.json()
Esempio n. 2
0
 def put(self, movie):
     args = Movies_List.parser.parse_args()
     item = Movies.find_by_title(movie)
     if item:
         item.collection = args['collection']
         item.save_to()
         return {'Movie': item.json()}
     item = Movies(movie, args['director'], args['genre'], args['collection'])
     item.save_to()
     return item.json()