Example #1
0
 def _create_note(self, user):
     note_data = {
         'title': self.request.get('title'),
         'content': self.request.get('content')
     }
     item_titles = self.request.get('checklist_items').split(',')
     Note.create_note(user, note_data, item_titles)
Example #2
0
    def post(self):
        form = AddNoteForm(self.request.arguments)

        if form.validate:
            title = form.data.get('title', '')
            tag = form.data.get('tag', '')
            hide = form.data.get('hide', '')
            content = form.data.get('content', '')

            Note.create_note(title, tag, hide, content)
            self.redirect(self.reverse_url('admin-note'))
        else:
            self.return_status(400, form.errors)
Example #3
0
    def post(self):
        user = users.get_current_user()
        if user is None:
            self.error(401)

        note_data = json.loads(self.request.body)
        note = Note.create_note(user, note_data, note_data['checklist_items'].split(','))

        self.response.headers['Content-Type'] = 'application/json'
        self.response.out.write(note.to_json())