Beispiel #1
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)
Beispiel #2
0
 def post(self):
   g = self.request.get("th")
   i=int(g)
   c=Theme.get_by_id(i)
   o=ThemeTwo.all().get()
   if o is not None:
     o.link=c.link
     o.name=c.name
     o.author=c.author
     o.put()
   else:  
     m=ThemeTwo()
     m.link=c.link
     m.name=c.name
     m.author=c.author
     m.put()
   self.redirect(self.request.referer)
Beispiel #3
0
 def get(self,page=1):
   page=int(page)
   limit=4
   #modelDocPost_query = DocPost.all().order('-date')
   p=DocPostM()
   modelDocPost_query = p.get_docpost() 
   count=modelDocPost_query.count()
   if (page-1)*limit>count:
     self.redirect("/error/")
   mm=self.navigationCM(page,count,limit)
   of=(mm['current']-1)*limit
   modelDocPost = modelDocPost_query.fetch(limit=limit, offset=of)
   listNeed=self.listNeedCM()
   tagList=DocTag.all()
   link=ListYou.all()
   pro=Profile.all()
   theme=ThemeTwo.all()
   template_values = {'modelDocPost': modelDocPost,'listNeed': listNeed,'mm': mm,'tagList': tagList,'link': link,'pro': pro,'theme': theme,}
   self.htmlRenderCM('../template/doc.html',template_values)
Beispiel #4
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)
Beispiel #5
0
 def post(self):
   g = self.request.get("th")
   o=ThemeTwo.all().get()
   if o is not None:
     if g=="white":
       o.link=db.Link("http://www.v2ex.com/")
       o.name="white"
       o.author="livid"
       o.put()
     elif g=="purple":
       o.link=db.Link("http://www.v2ex.com/")
       o.name="purple"
       o.author="livid"
       o.put()
     elif g=="orange":
       o.link=db.Link("http://www.v2ex.com/")
       o.name="orange"
       o.author="livid"
       o.put()
     elif g=="night":
       o.link=db.Link("http://www.v2ex.com/")
       o.name="night"
       o.author="livid"
       o.put()
     elif g=="dust":
       o.link=db.Link("http://www.v2ex.com/")
       o.name="dust"
       o.author="livid"
       o.put()
     elif g=="mour":
       o.link=db.Link("http://blog.kf25.cn/romoo")
       o.name="mour"
       o.author="Romoo"
       o.put()
     elif g=="light":
       o.link=db.Link("http://www.v2ex.com/")
       o.name="light"
       o.author="livid"
       o.put()
     elif g=="grid":
       o.link=db.Link("http://www.singrun.com/")
       o.name="grid"
       o.author="singrun"
       o.put()
     elif g=="cloud":
       o.link=db.Link("http://www.saicn.com/")
       o.name="cloud"
       o.author="sai"
       o.put()
     elif g=="flamingo":
       o.link=db.Link("http://www.ccdjh.com/")
       o.name="flamingo"
       o.author="livid"
       o.put()
     elif g=="tropical":
       o.link=db.Link("http://www.ccdjh.com/")
       o.name="tropical"
       o.author="ccdjh"
       o.put()
     elif g=="ivory":
       o.link=db.Link("http://www.ccdjh.com/")
       o.name="ivory"
       o.author="ccdjh"
       o.put()
     elif g=="cerulean":
       o.link=db.Link("http://www.ccdjh.com/")
       o.name="cerulean"
       o.author="ccdjh"
       o.put()
     elif g=="cobalt":
       o.link=db.Link("http://www.ccdjh.com/")
       o.name="cobalt"
       o.author="ccdjh"
       o.put()
     elif g=="coffee":
       o.link=db.Link("http://www.ccdjh.com/")
       o.name="coffee"
       o.author="ccdjh"
       o.put()
     elif g=="redstar":
       o.link=db.Link("http://www.ccdjh.com/")
       o.name="redstar"
       o.author="ccdjh"
       o.put()
     else:
       i=int(g)
       c=Theme.get_by_id(i)
       o.link=c.link
       o.name=c.name
       o.author=c.author
       o.put()
   else:
     m=ThemeTwo()
     if g=="white":
       m.link=db.Link("http://www.v2ex.com/")
       m.name="white"
       m.author="livid"
       m.put()
     elif g=="purple":
       m.link=db.Link("http://www.v2ex.com/")
       m.name="purple"
       m.author="livid"
       m.put()
     elif g=="orange":
       m.link=db.Link("http://www.v2ex.com/")
       m.name="orange"
       m.author="livid"
       m.put()
     elif g=="night":
       m.link=db.Link("http://www.v2ex.com/")
       m.name="night"
       m.author="livid"
       m.put()
     elif g=="dust":
       m.link=db.Link("http://www.v2ex.com/")
       m.name="dust"
       m.author="livid"
       m.put()
     elif g=="mour":
       m.link=db.Link("http://blog.kf25.cn/romoo")
       m.name="mour"
       m.author="romoo"
       m.put()
     elif g=="light":
       m.link=db.Link("http://www.v2ex.com/")
       m.name="light"
       m.author="livid"
       m.put()
     elif g=="grid":
       m.link=db.Link("http://www.singrun.com/")
       m.name="grid"
       m.author="singrun"
       m.put()
     elif g=="cloud":
       m.link=db.Link("http://www.saicn.com/")
       m.name="cloud"
       m.author="sai"
       m.put()
     elif g=="flamingo":
       m.link=db.Link("http://www.ccdjh.com/")
       m.name="flamingo"
       m.author="ccdjh"
       m.put()
     elif g=="tropical":
       m.link=db.Link("http://www.ccdjh.com/")
       m.name="tropical"
       m.author="ccdjh"
       m.put()
     elif g=="ivory":
       m.link=db.Link("http://www.ccdjh.com/")
       m.name="ivory"
       m.author="ccdjh"
       m.put()
     elif g=="cerulean":
       m.link=db.Link("http://www.ccdjh.com/")
       m.name="cerulean"
       m.author="ccdjh"
       m.put()
     elif g=="cobalt":
       m.link=db.Link("http://www.ccdjh.com/")
       m.name="cobalt"
       m.author="ccdjh"
       m.put()
     elif g=="coffee":
       m.link=db.Link("http://www.ccdjh.com/")
       m.name="coffee"
       m.author="ccdjh"
       m.put()
     elif g=="redstar":
       m.link=db.Link("http://www.ccdjh.com/")
       m.name="redstar"
       m.author="ccdjh"
       m.put()
     else:
       i=int(g)
       c=Theme.get_by_id(i)
       m.link=c.link
       m.name=c.name
       m.author=c.author
       m.put()
   self.redirect(self.request.referer)