def delete(self,*args): if self.params.key: item = ActivityLog.get(self.params.key) if item: item.delete() self.status ='ActivityLog is deleted!' else: self.status='ActivityLog does not exist' else: self.status = 'Key was not Provided!' self.redirect(ActivityLogController.get_url())
def details(self, *args): if self.params.key: item = ActivityLog.get(self.params.key) if item: return {'op':'update', 'ActivityLogForm': ActivityLogForm(instance=item)} else: self.status = 'ActivityLog does not exists' self.redirect(ActivityLogController.get_url()) else: self.status = 'Key not provided' return {'op':'insert' ,'ActivityLogForm':ActivityLogForm()}
def save(self, *args): instance = None if self.params.key: instance = ActivityLog.get(self.params.key) form=ActivityLogForm(data=self.request.POST, instance=instance) if form.is_valid(): result=form.save(commit=False) result.put() self.status = 'ActivityLog is saved' self.redirect(ActivityLogController.get_url()) else: self.SetTemplate(templateName = 'ActivityLog_edit.html') self.status = 'Form is not Valid' return {'op':'update', 'ActivityLogForm': form}