def create(self): form = EditCollectionForm(self.request.POST) if not form.is_valid(): return self.json_error('collections.collections.create.form_errors', form.errors) collection = CollectionPrototype.create(caption=form.c.caption, description=form.c.description) return self.json_ok(data={'next_url': url('collections:collections:show', collection.id)})
def update(self, method='post'): form = EditCollectionForm(self.request.POST) if not form.is_valid(): return self.json_error('collections.collections.update.form_errors', form.errors) self.collection.caption = form.c.caption self.collection.description = form.c.description self.collection.save() return self.json_ok()
def update(self, method='post'): form = EditCollectionForm(self.request.POST) if not form.is_valid(): return self.json_error( 'collections.collections.update.form_errors', form.errors) self.collection.caption = form.c.caption self.collection.description = form.c.description self.collection.save() return self.json_ok()
def create(self): form = EditCollectionForm(self.request.POST) if not form.is_valid(): return self.json_error( 'collections.collections.create.form_errors', form.errors) collection = CollectionPrototype.create(caption=form.c.caption, description=form.c.description) return self.json_ok( data={ 'next_url': url('collections:collections:show', collection.id) })