def details(self, *args): if self.params.key: item = Sprint.get(self.params.key) if item: return {'Sprint': item} else: self.status = 'Sprint does not exists' self.redirect(SprintController.get_url()) else: self.status = 'Key not provided' self.redirect(SprintController.get_url())
def delete(self,*args): if self.params.key: item = Sprint.get(self.params.key) if item: item.delete() self.status ='Sprint is deleted!' else: self.status='Sprint does not exist' else: self.status = 'Key was not Provided!' self.redirect(SprintController.get_url())
def edit(self, *args): if self.params.key: item = Sprint.get(self.params.key) if item: return {'op':'update', 'SprintForm': SprintForm(instance=item)} else: self.status = 'Sprint does not exists' self.redirect(SprintController.get_url()) else: self.status = 'Key not provided' return {'op':'insert' ,'SprintForm':SprintForm()}
def index(self, *args): results =None index = 0; count=20 try: index = int(self.params.index) count = int(self.params.count) except: pass nextIndex = index+count; previousIndex = index<=0 and -1 or (index-count>0 and 0 or index-count) result = {'SprintList': Sprint.all().fetch(limit=count, offset=index)} result.update(locals()) return result
def save(self, *args): instance = None if self.params.key: instance = Sprint.get(self.params.key) form=SprintForm(data=self.request.POST, instance=instance) if form.is_valid(): result=form.save(commit=False) result.put() self.status = 'Sprint is saved' self.redirect(SprintController.get_url()) else: self.SetTemplate(templateName = 'Sprint_edit.html') self.status = 'Form is not Valid' return {'op':'update', 'SprintForm': form}