Exemple #1
0
    def post(self):
        json = request.get_json(silent=True)
        if not json:
            raise HTTPError(400, 'Invalid request type')

        notes = Notes()
        notes.validate_notes(json)
        notes.add_notes(json)
        return jsonify()
 def index():
     note = Notes()
     todays_note = note.get_todays_note()
     counts = note.get_notes_count()
     return render_template(
         'index.html',
         red=counts['red'],
         blue=counts['blue'],
         green=counts['green'],
         note=todays_note
     )
 def selected(type):
     note = Notes()
     todays_note = note.get_todays_note(type)
     colors = {
         'red': '#FF6666',
         'green': '#559955',
         'blue': '0000FF'
     }
     if todays_note:
         message = todays_note.note
     else:
         message = 'Sorry no note for this color today :('
     return render_template(
         'selected.html',
         color=colors[type],
         message=message,
         has_message=todays_note is not None
     )