Esempio n. 1
0
    def _dodeleted(self):
        to_delete = request.POST.getall('delete')

        for id in to_delete:
            Image.load(self.db, id).delete_permanently(self.db)

        redirect(url(controller='admin', action='deleted'))
Esempio n. 2
0
 def _doaccepted(self):
     to_delete = request.POST.getall('delete')
     
     # Delete them
     for id in to_delete:
         Image.load(self.db, id).delete(self.db)
         
     redirect(url(controller='admin', action='accepted'))
Esempio n. 3
0
 def _dopending(self):
     # These are all the images ticked with accept
     to_accept = request.POST.getall('accept')
     
     # Accept all of them
     for id in to_accept:
         image = Image.load(self.db, id)
         image.state = 'accepted'
         image.store(self.db)
     
     # These are the ones to delete
     to_delete = request.POST.getall('delete')
     
     # Delete them
     for id in to_delete:
         Image.load(self.db, id).delete(self.db)
         
     redirect(url(controller='admin', action='pending'))
Esempio n. 4
0
    def _doedit(self, id):
        image = Image.load(self.db, id)
        
        image.author = request.params.getone('author')
        image.author_email = request.params.getone('author_email')
        image.author_url = request.params.getone('author_url')
        image.text = request.params.getone('text')

        # "change_day" is a hidden field that indicates that the date
        # is exposed in the form. we don't change the day if we are
        # setting the image to pending, since this creates problems
        # when detecting if the image has changed date
        if ('change_day' in self.form_result) and request.params.getone('state') == 'accepted':
            image.day = datetime(year=int(self.form_result.get('year')),
                                 month=int(self.form_result.get('month')),
                                 day=int(self.form_result.get('day')))
        
        image.state = self.form_result.get('state')

        image.store(self.db)

        flash('Image successfully edited')
        redirect(url(controller='admin', action='edit', id=id))
Esempio n. 5
0
    def edit(self, id):
        c.image = Image.load(self.db, id)

        return render('/admin/edit.mako')