def get(self): args = parser.parse_args() if args['level']: moods = Mood.select().where(Mood.level == args['level']) else: moods = Mood.select() serialized = MoodSerializer(list(moods), many=True) return jsonify({"moods": serialized.data})
def get(self, year, month, day): moods = Mood.select().where(Mood.created.between( datetime.date(year, month, day), datetime.date(year, month, day) + datetime.timedelta(days=1))) serialized = MoodSerializer(list(moods), many=True) return jsonify({"moods": serialized.data})