Пример #1
0
    def post(self):
        self.response.headers['Content-Type'] = 'application/json'

        userId = str(self.current_user.key.id())

        newBlog = Blog(user_id=userId,
                       journey_id=self.request.get('journey_id'))
        newBlog.blog_id = self.request.get('blog_id')
        newBlog.blog_link = self.request.get('blog_link')
        newBlog.blog_url = self.request.get('blog_url')
        newBlog.blog_content = self.request.get('blog_content')
        newBlog.post_time = getTimeEpoch()

        newBlog.put()

        self.response.write(json.dumps({'blog_id': str(newBlog.key())}))
Пример #2
0
    def get(self, blog_id):
        self.response.headers['Content-Type'] = 'application/json'

        blog = Blog.get(blog_id)
        blogInfo = dict(blog.__dict__['_entity'])
        blogInfo['id'] = str(blog.key())

        self.response.write(json.dumps({'blog': blogInfo}))
Пример #3
0
 def post(self):
     self.response.headers['Content-Type'] = 'application/json'
     
     userId = str(self.current_user.key.id())
     
     newBlog = Blog(user_id = userId,journey_id = self.request.get('journey_id'))
     newBlog.blog_id = self.request.get('blog_id')
     newBlog.blog_link = self.request.get('blog_link')
     newBlog.blog_url = self.request.get('blog_url')
     newBlog.blog_content = self.request.get('blog_content')
     newBlog.post_time = getTimeEpoch()
     
     newBlog.put()
     
     self.response.write(json.dumps({'blog_id' : str(newBlog.key())}))
Пример #4
0
 def get(self,blog_id):
     self.response.headers['Content-Type'] = 'application/json'
     
     blog = Blog.get(blog_id)
     blogInfo = dict(blog.__dict__['_entity'])
     blogInfo['id'] = str(blog.key())
     
     self.response.write(json.dumps({'blog' : blogInfo}))