예제 #1
0
 def get(self):
     template_values = {
         'nav': 'aboutme',
     }
     template = JINJA_ENVIRONMENT.get_template(
         'main/templates/aboutme.html')
     self.response.write(template.render(template_values))
예제 #2
0
파일: main.py 프로젝트: fdoperezi/trading
    def get(self):
        # new movies
        self.template_values['movies'] = Torrent.query(Torrent.category_code == 207, Torrent.uploader == 'YIFY', Torrent.resolution == 720).order(-Torrent.uploaded_at).fetch(30)

        # new series
        self.template_values['series_new'] = Torrent.query(Torrent.category_code == 205, Torrent.series_episode == 1).order(-Torrent.uploaded_at).fetch(15)

        episodes_new = []
        series_watching = []

        # watching series
        uts = UserTorrent.query(UserTorrent.user == users.get_current_user(), UserTorrent.category_code == 205).fetch()
        if uts:
            series_watching = set()
            for ut in [ut for ut in uts if ut.torrent.get().series_title]:
                series_watching.add(ut.torrent.get().series_title)
            logging.info('{0} series being watched by user'.format(len(uts)))

            # new episodes
            if series_watching:
                cutoff = arrow.utcnow().replace(days=-14).datetime
                episodes_new = Torrent.query(Torrent.series_title.IN(series_watching), Torrent.uploaded_at > cutoff, Torrent.category_code == 205).order(-Torrent.uploaded_at).fetch()
                logging.info('{0} episodes fetched for watched series'.format(len(episodes_new)))

        self.template_values['series_watching'] = series_watching
        self.template_values['episodes_new'] = episodes_new

        # logging.info('{0}'.format(self.template_values))
        template = JINJA_ENVIRONMENT.get_template('main/templates/index.html')
        self.response.write(template.render(self.template_values))
예제 #3
0
 def get(self, gallery):
     paintings = Painting.query(ancestor=self.parent_key).filter(Painting.gallery == gallery).fetch()
     template_values = {
         'nav': gallery,
         'paintings': paintings,
     }
     template = JINJA_ENVIRONMENT.get_template('main/templates/gallery.html')
     self.response.write(template.render(template_values))
예제 #4
0
 def get(self):
     paintings = Painting.query(ancestor=self.parent_key).order(-Painting.updated_at).fetch()
     template_values = {
         'paintings': paintings,
         'galleries': Painting.CHOICES_GALLERIES,
         'tab': self.request.GET.get('tab', 'figures'),
     }
     template = JINJA_ENVIRONMENT.get_template('main/templates/admin.html')
     self.response.write(template.render(template_values))
예제 #5
0
 def get(self):
     paintings = Painting.query(
         ancestor=self.parent_key).order(-Painting.updated_at).fetch()
     template_values = {
         'paintings': paintings,
         'galleries': Painting.CHOICES_GALLERIES,
         'tab': self.request.GET.get('tab', 'figures'),
     }
     template = JINJA_ENVIRONMENT.get_template('main/templates/admin.html')
     self.response.write(template.render(template_values))
예제 #6
0
 def get(self, gallery):
     paintings = Painting.query(ancestor=self.parent_key).filter(
         Painting.gallery == gallery).fetch()
     template_values = {
         'nav': gallery,
         'paintings': paintings,
     }
     template = JINJA_ENVIRONMENT.get_template(
         'main/templates/gallery.html')
     self.response.write(template.render(template_values))
예제 #7
0
파일: main.py 프로젝트: fdoperezi/trading
    def get(self, cat):
        logging.info('cat {0}'.format(cat))
        self.template_values['cat'] = int(cat)

        # get torrents
        torrents = Torrent.query(Torrent.category_code == int(cat)).order(-Torrent.uploaded_at).fetch()
        self.template_values['torrents'] = torrents
        logging.info('torrents {0}'.format(len(torrents)))

        template = JINJA_ENVIRONMENT.get_template('main/templates/category.html')
        self.response.write(template.render(self.template_values))
예제 #8
0
 def get(self):
     key = self.request.GET.get('key')
     if key:
         painting = ndb.Key(urlsafe=key).get()
     else:
         painting = Painting()
     template_values = {
         'galleries': Painting.CHOICES_GALLERIES,
         'painting': painting,
     }
     template = JINJA_ENVIRONMENT.get_template('main/templates/form.html')
     self.response.write(template.render(template_values))
예제 #9
0
 def get(self):
     key = self.request.GET.get('key')
     if key:
         painting = ndb.Key(urlsafe=key).get()
     else:
         painting = Painting()
     template_values = {
         'galleries': Painting.CHOICES_GALLERIES,
         'painting': painting,
     }
     template = JINJA_ENVIRONMENT.get_template('main/templates/form.html')
     self.response.write(template.render(template_values))
예제 #10
0
 def get(self):
     paintings = Painting.query(ancestor=self.parent_key).fetch()
     specials = [painting for painting in paintings if painting.special]
     originals = [painting for painting in paintings if (not painting.special and not painting.sold)]
     prints = [painting for painting in paintings if (not painting.special and painting.copy)]
     template_values = {
         'nav': 'available',
         'specials': specials,
         'originals': originals,
         'prints': prints,
     }
     template = JINJA_ENVIRONMENT.get_template('main/templates/available.html')
     self.response.write(template.render(template_values))
예제 #11
0
 def get(self):
     paintings = Painting.query(ancestor=self.parent_key).fetch()
     specials = [painting for painting in paintings if painting.special]
     originals = [
         painting for painting in paintings
         if (not painting.special and not painting.sold)
     ]
     prints = [
         painting for painting in paintings
         if (not painting.special and painting.copy)
     ]
     template_values = {
         'nav': 'available',
         'specials': specials,
         'originals': originals,
         'prints': prints,
     }
     template = JINJA_ENVIRONMENT.get_template(
         'main/templates/available.html')
     self.response.write(template.render(template_values))
예제 #12
0
 def get(self):
     template_values = {
         'nav': 'aboutme',
     }
     template = JINJA_ENVIRONMENT.get_template('main/templates/aboutme.html')
     self.response.write(template.render(template_values))