def get(self, direction, displayOrderToMove):
     displayOrderToMove = int(displayOrderToMove)
     # I am assuming displayOrder has no duplicates
     FirstObject = Newsletter.gql("WHERE DisplayOrder = :1", displayOrderToMove).get()
     if direction == 'u':
         SecondObject = Newsletter.gql("WHERE DisplayOrder > :1 ORDER BY DisplayOrder ASC", displayOrderToMove).get()
     else:
         SecondObject = Newsletter.gql("WHERE DisplayOrder < :1 ORDER BY DisplayOrder DESC",
                                       displayOrderToMove).get()
     FirstObject.DisplayOrder, SecondObject.DisplayOrder = SecondObject.DisplayOrder, FirstObject.DisplayOrder
     FirstObject.put()
     SecondObject.put()
     self.redirect('/manage/newsletter_archive')
 def post(self):
     newNewsletter = Newsletter(
         Title=self.request.get("title"),
         NewsletterBlob=self.get_uploads('file')[0]._BlobInfo__key,
     )
     displayOrderObject = Newsletter.gql("ORDER BY DisplayOrder DESC").get()
     newNewsletter.DisplayOrder = displayOrderObject.DisplayOrder + 1 if displayOrderObject else 1
     newNewsletter.put()
     self.redirect('/manage/newsletter_archive')
    def get(self):
        self.generate_manage_bar()
        self.template_vars['uploadURL'] = blobstore.create_upload_url('/manage/newsletter_archive/upload')
        self.template_vars['Newsletters'] = Newsletter.gql("ORDER BY DisplayOrder DESC").fetch(50)

        self.render_template("manage/newsletter_archive/newsletter_archive.html")
Exemplo n.º 4
0
 def get(self):
     self.template_vars['Newsletters'] = Newsletter.gql("ORDER BY DisplayOrder DESC").fetch(50)
     self.render_template("alumni/newsletter.html")