コード例 #1
0
ファイル: postControl.py プロジェクト: ccdjh/CmChrysanthemum
 def post(self):
   c = self.request.get("commentIdc")
   cc=int(c)
   q=DocPost.get_by_id(cc)
   comment = DocComment(contact=q)
   comment.comment = self.request.get("content")
   #gravatar = self.request.get("gravatar")
   comment.postid = cc
   if users.get_current_user():
     com= users.get_current_user()
     comm=com.email()
     comment.author = db.Email(comm)
     comment.googleauthor= users.get_current_user()
   #myurl=self.request.host_url
   default = self.request.host_url+"/static/image/gravatars.jpg"
   size=40
   comment.image=self.gravatarCM(comm,default,size)
   comment.put()
   count=DocPost.all().filter('idc = ', cc).get()
   count.commentcount += 1
   m=comment.key().id()
   comment.idc = m
   comment.put()
   count.put()
   self.redirect(self.request.referer)
コード例 #2
0
ファイル: getControl.py プロジェクト: ccdjh/CmChrysanthemum
 def get(self,idc,title):
   idcc=int(idc)
   modelDocOne=DocPost.all().filter('idc = ', idcc)
   modelDocOne.get()
   if modelDocOne.count()==0:
     self.redirect("/error/")
   u=users.get_current_user()
   listNeed=self.listNeedCM()
   pro=Profile.all()
   tagList=DocTag.all()
   link=ListYou.all()
   theme=ThemeTwo.all()
   listNeed=self.listNeedCM()
   template_values = {'modelDocOne': modelDocOne,'u': u,'listNeed': listNeed,'pro': pro,'tagList': tagList,'link': link,'listNeed': listNeed,'theme': theme,}
   self.htmlRenderCM('../template/one.html',template_values)
コード例 #3
0
ファイル: htmlControl.py プロジェクト: ccdjh/CmChrysanthemum
 def get(self,page=1):
   listNeed=self.listNeedCM()
   link=ListYou.all()
   #comment=DocPost.all()
   page=int(page)
   limit=5
   comment_query = DocPost.all().order('-date')
   count=comment_query.count()
   if (page-1)*limit>count:
     self.redirect("/error/")
   mm=self.navigationCM(page,count,limit)
   of=(mm['current']-1)*limit
   comment = comment_query.fetch(limit=limit, offset=of)
   template_values = {'listNeed': listNeed,'link': link,'comment': comment,'mm': mm,}
   self.htmlRenderCM('../template/list.html',template_values)
コード例 #4
0
ファイル: getControl.py プロジェクト: ccdjh/CmChrysanthemum
 def get(self,tagc,page=1):
   page=int(page)
   tagText=urllib.unquote(tagc).decode("utf-8")
   limit=2
   m=DocPost.all().filter('tags =', tagText)
   if m.count()==0:
     self.redirect("/error/")
   count=m.count()
   if (page-1)*limit>count:
     self.redirect("/error/")
   mm=self.navigationCM(page,count,limit)
   of=(mm['current']-1)*limit
   modelDocTag=m.fetch(limit=limit, offset=of)
   pro=Profile.all()
   tagList=DocTag.all()
   link=ListYou.all()
   theme=ThemeTwo.all()
   listNeed=self.listNeedCM()
   template_values = {'modelDocTag': modelDocTag,'mm': mm,'pro': pro,'tagList': tagList,'link': link,'listNeed': listNeed,'theme': theme,}
   self.htmlRenderCM('../template/tag.html',template_values)
コード例 #5
0
ファイル: htmlControl.py プロジェクト: ccdjh/CmChrysanthemum
 def get(self,idc):
   g =int(idc)
   y=DocPost.all().filter('idc = ', g)
   template_values = {'y': y,}
   self.htmlRenderCM('../template/put.html',template_values)
コード例 #6
0
ファイル: htmlControl.py プロジェクト: ccdjh/CmChrysanthemum
 def get(self):
   listNeed=self.listNeedCM()
   docc=DocPost.all().order('-date')
   doc = docc.fetch(limit=10, offset=0)
   template_values = {'listNeed': listNeed,'doc': doc,}
   self.htmlRenderCM('../template/admin.html',template_values)
コード例 #7
0
 def render_docpost(self):
   results = DocPost.all().order('-date')
   return results