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)
            })
Esempio n. 5
0
    def edit(self):
        form = EditCollectionForm(
            initial={
                'caption': self.collection.caption,
                'description': self.collection.description
            })

        return self.template('collections/collections/edit.html',
                             {'form': form})
Esempio n. 6
0
 def new(self):
     return self.template('collections/collections/new.html',
                          {'form': EditCollectionForm()})