예제 #1
0
파일: views.py 프로젝트: phocode/myblog
 def get(self, tag):
   posts = Post.objects(tags=tag)
   tags = Post.objects.distinct("tags")
   all_tags = []
   for tag in tags:
     all_tags.append({
       'tag': tag,
       'count': Post.objects(tags=tag).count()
       })
   print all_tags
   return render_template('posts/list.html', posts = posts, tags = all_tags)
예제 #2
0
파일: views.py 프로젝트: phocode/myblog
 def get(self):
   user = User.objects.get(id=current_user.id)
   form = ProfileForm(obj=user)
   posts = Post.objects(author=current_user.id)
   return render_template('users/profile.html', 
       form=form,
       posts = posts,
       user = user,
       twitter_conn=social.twitter.get_connection(),
       facebook_conn=social.facebook.get_connection())
예제 #3
0
파일: views.py 프로젝트: phocode/myblog
 def get(self):
   posts = Post.objects(author=current_user.id)
   return render_template('users/personal.html', posts=posts)
예제 #4
0
파일: views.py 프로젝트: phocode/myblog
 def get(self, username):
   user = User.objects.get_or_404(username=username)
   posts = Post.objects(author=user.id)
   return render_template('users/user.html', user=user, posts=posts)