def post(self): modelProfile=Profile.all().get() #img=self.request.get("img") #if img =="": # self.redirect("/error/") if modelProfile is not None: modelProfile.name = self.request.get("name") modelProfile.about = self.request.get("about") modelProfile.title = self.request.get("title") modelProfile.description = self.request.get("description") #imgb = images.resize(self.request.get("img"),46,46) modelProfile.avatar = db.Blob(self.request.get("img")) modelProfile.put() m=modelProfile.key().id() modelProfile.idc = m modelProfile.put() else: modelProfileb=Profile() modelProfileb.name = self.request.get("name") modelProfileb.about = self.request.get("about") modelProfileb.title = self.request.get("title") modelProfileb.description = self.request.get("description") #imgb = images.resize(self.request.get("img"),46,46) modelProfileb.avatar = db.Blob(self.request.get("img")) modelProfileb.put() m=modelProfileb.key().id() modelProfileb.idc = m modelProfileb.put() self.redirect(self.request.referer)
def get(self): listNeed=self.listNeedCM() #p=ProfileM() #about = p.get_profile() about=Profile.all() template_values = {'listNeed': listNeed,'about': about,} self.htmlRenderCM('../template/about.html',template_values)
def get(self): p=DocPostM() feed = p.get_docpost() #feed=DocPost.all().order('-date') myurl=self.request.host_url pro=Profile.all() template_values = {'feed': feed,'myurl': myurl,'pro': pro,} self.htmlRenderCM('../template/feed.xml',template_values)
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)
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)
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)
def render_profile(self): results = Profile.all().get() return results