Example #1
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))
Example #2
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))
Example #3
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))
Example #4
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))
Example #5
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))
Example #6
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))
Example #7
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))
Example #8
0
    def post(self):
        key = self.request.GET.get('key')
        if key:
            painting = ndb.Key(urlsafe=key).get()
        else:
            painting = Painting(parent=self.parent_key)
            image_upload = self.request.POST.get('image')
            image_name = image_upload.filename
            painting.image = image_upload.file.read()
            painting.image_name = image_name

        painting.gallery = str(self.request.POST.get('gallery'))
        painting.name = self.request.POST.get('name')
        painting.description = self.request.POST.get('description')
        painting.price = int(self.request.POST.get('price'))
        painting.special = bool(self.request.POST.get('special'))
        painting.sold = bool(self.request.POST.get('sold'))
        painting.copy = bool(self.request.POST.get('copy'))
        painting.copy_price = int(self.request.POST.get('copy_price'))
        painting.put()
        self.redirect('/admin?tab=%s' % painting.gallery)
Example #9
0
    def post(self):
        key = self.request.GET.get('key')
        if key:
            painting = ndb.Key(urlsafe=key).get()
        else:
            painting = Painting(parent=self.parent_key)
            image_upload = self.request.POST.get('image')
            image_name = image_upload.filename
            painting.image = image_upload.file.read()
            painting.image_name = image_name

        painting.gallery = str(self.request.POST.get('gallery'))
        painting.name = self.request.POST.get('name')
        painting.description = self.request.POST.get('description')
        painting.price = int(self.request.POST.get('price'))
        painting.special = bool(self.request.POST.get('special'))
        painting.sold = bool(self.request.POST.get('sold'))
        painting.copy = bool(self.request.POST.get('copy'))
        painting.copy_price = int(self.request.POST.get('copy_price'))
        painting.put()
        self.redirect('/admin?tab=%s' % painting.gallery)