Example #1
0
File: main.py Project: kronic/kion
	def get(self):
		if self.request.get('action') == 'delete':
			fav = db.get(db.Key(self.request.get('id')))
			
			if fav:  fav.delete();
			
			return self.redirect('/tabmgt')
		elif self.request.get('action') == 'update':
			fav = db.get(db.Key(self.request.get('id')))
			
			values = { 'fav': fav }
		else:
			if self.request.get('fld'):
				fld = db.get(db.Key(self.request.get('fld')))
				favs = Fav.all().filter('fieldset', fld)
			else:
				return self.redirect('/tabmgt')

			values = { 'fld': fld, 'favs': favs }
		path = os.path.join(os.path.dirname(__file__), 'templates/favmgt.html')
		self.response.out.write(template.render(path, values))
Example #2
0
File: main.py Project: kronic/kion
	def post(self):
		if self.request.get('action') == 'update':
			fav = db.get(db.Key(self.request.get('id')))
		else:
			fav = Fav()
			fav.fieldset = db.get(db.Key(self.request.get('fld')))

		if users.get_current_user():
			fav.author = users.get_current_user()		
		fav.code_name = self.request.get('code_name')
		fav.title = self.request.get('title')
		fav.category = self.request.get('category')
		fav.sequence = self.request.get('sequence')
		fav.description = self.request.get('description')
		fav.link = self.request.get('link')
		fav.style_class = self.request.get('style_class')
		fav.on_click = self.request.get('on_click')
		fav.level = int(self.request.get('level'))
		
		fav.put()
		return self.redirect('/tabmgt')