Exemple #1
0
 def add_action(self):
     name = self.request.get('name')
     task = Task()
     task.set_origin_name(name)
     task.put()
     output = simplejson.dumps(task.to_dict())
     self.response.out.write(output)
Exemple #2
0
    def post(self, **kwargs):
        if not self.form.validate():
            # Since the form didn't validate, render it again using self.get().
            return self.get(**kwargs)

        author = self.auth_current_user
        if author != None:
            author = author.username

        # Form is valid. Use the form data and redirect the user to the
        # final destination.
        name = self.form.name.data
        assignee = self.form.assignee.data
        description = self.form.description.data
        task = Task(name=name, assignee=assignee, description=description, created_by=author, updated_by=author, author=author)

        task.put()
        memcache.delete('tasks')

        return redirect_to('tasks-index')