Пример #1
0
 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
 def post(self):
   c = self.request.get("commentIdc")
   cc=int(c)
   modelDocPost=DocPost.get_by_id(cc)
   modelDocPost.content = self.request.get("content")
   modelDocPost.title = self.request.get("title")
   modelDocPost.put()
   self.redirect("/admin/doclist/")
Пример #3
0
 def get(self,idc,idd):    
   g =int(idc)
   y=DocComment.get_by_id(g)
   db.delete(y)
   gg =int(idd)
   yy=DocPost.get_by_id(gg)
   yy.commentcount=yy.commentcount-1
   yy.put()
   self.redirect(self.request.referer)
Пример #4
0
 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)
Пример #5
0
 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)
Пример #6
0
 def get(self,idc):    
   g =int(idc)
   y=DocPost.get_by_id(g)
   for tt in y.tags:
     ttt=tt
     ttt=DocTag.all().filter('tag =', tt).get()
     if ttt.tagcount>1:
       ttt.tagcount=ttt.tagcount-1
       ttt.put()
     else:
       db.delete(ttt)
   yy=y.idc
   t=DocComment.all().filter('postid =', yy)
   db.delete(y)
   db.delete(t)
   self.redirect(self.request.referer)
Пример #7
0
 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)
Пример #8
0
 def post(self):
   modelDocPost=DocPost()
   modelDocTag=DocTag()
   if users.get_current_user():
     modelDocPost.author = users.get_current_user()
   modelDocPost.content = self.request.get("content")
   modelDocPost.title = self.request.get("title")
   modelDocPost.put()
   m=modelDocPost.key().id()
   modelDocPost.idc = m
   modelDocPost.put()
   
   v= self.request.get("tags")
   if v=="":
     v="chrysanthemum"
   vv=re.split(',',v)
   for vvv in vv :
     ccc=vvv
     ccc=DocTag()
     bbb=DocTag()
     cccc=bbb.all().filter('tag = ', vvv).get()
     if cccc is not None:
       cccc.tagcount += 1
       cccc.put()
     else:
       ccc.tag=vvv
       ccc.put()
     vvvv=vvv
     modelDocPost.tags.append(vvvv)
     modelDocPost.put()
   self.redirect(self.request.referer)
Пример #9
0
 def get(self,idc):
   g =int(idc)
   y=DocPost.all().filter('idc = ', g)
   template_values = {'y': y,}
   self.htmlRenderCM('../template/put.html',template_values)
Пример #10
0
 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)
Пример #11
0
 def render_docpost(self):
   results = DocPost.all().order('-date')
   return results