Esempio n. 1
0
    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)})
Esempio n. 2
0
    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()
Esempio n. 3
0
    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()
Esempio n. 4
0
    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)
            })