예제 #1
0
def create_new_blog():
    if request.method == 'GET':
        return render_template('new_blog.html')
    else:  # post: received post data from 'new_blog.html'
        title = request.form['title']
        description = request.form['description']
        user = User.get_by_email(session['email'])

        new_blog = Blog(user.email, title, description, user._id)
        new_blog.save_to_mongo()
        # make_response is to turn to function user_blog with the value user._id
        blogs = Blog.find_by_author_id(user._id)
        return render_template("profile.html",
                               email=session['email'],
                               blogs=blogs)
예제 #2
0
파일: user.py 프로젝트: 73zillion/Webapps
 def get_blogs(self):
     return Blog.find_by_author_id(self._id)
예제 #3
0
    def get_blogs(self):

        # to call a class / static method just use Blog.
        return Blog.find_by_author_id(self._id)
예제 #4
0
 def get_blogs(self):
     # return blog class
     return Blog.find_by_author_id(self._id)
예제 #5
0
파일: user.py 프로젝트: patalwell/python
 def get_blogs(self):
     return Blog.find_by_author_id(self._id)
예제 #6
0
 def get_blogs(self):
     """ Get the blogs """
     return Blog.find_by_author_id(self._id)
예제 #7
0
 def get_blogs(self):
     return Blog.find_by_author_id(self._id)  # Now we find by author id
예제 #8
0
파일: user.py 프로젝트: bencastan/web-blog
 def get_blogs(self):
     # print("@user.get_blogs _id==: {}".format(self._id))
     return Blog.find_by_author_id(self._id)
예제 #9
0
 def get_blogs(self):
     blog = Blog.find_by_author_id(self._id)
     print("got the blog")
     return blog
예제 #10
0
파일: app.py 프로젝트: KenMwaura1/web-blog
def home_author(author_id):
    blogs = Blog.find_by_author_id(author_id)
    author = [blog.author for blog in blogs]
    author = author[0]
    return render_template('author_blogs.html', blogs=blogs, author=author)
예제 #11
0
파일: user.py 프로젝트: ibininja/blpymo
 def get_blogs(self):
     # Verify the structure of documents in DB for ease of retrieval.
     # Retrieval is best using an author ID because author name can be duplicated. unless is username. So Blog model is updated now to suit the change. prior only author name existed.
     return Blog.find_by_author_id(self._id)