Exemplo n.º 1
0
    def get(self, id):
        coupon = model.coupon_get(id)
        if coupon is None:
            webapp2.abort(404)

        values = {'coupon': coupon}
        write_template(self.response, 'check.html', values)
Exemplo n.º 2
0
    def get(self):
        home_url = self.app.config['home_url']
        if home_url:
            webapp2.redirect(home_url, abort=True)
            return

        values = {'coupon_types': model.list_coupon_types()}
        write_template(self.response, 'index.html', values)
Exemplo n.º 3
0
    def get(self, id):
        coupon = model.coupon_get(id)
        if coupon is None:
            webapp2.abort(404)

        values = {'coupon': coupon,
                  'qr': webapp2.uri_for('qr', id=id)
                  }

        write_template(self.response, 'coupon.html', values)
Exemplo n.º 4
0
    def post(self):
        form = CouponSpawnForm(self.request.params)
        if form.validate():
            self.generate(form.data)
            webapp2.redirect(webapp2.uri_for('spawn',
                                             msg='Kvietimai sugeneruoti'),
                             abort=True)
            return

        else:
            values = {'form': form}
            write_template(self.response, 'coupon_spawn.html', values)
Exemplo n.º 5
0
    def get(self, id):
        order = model.order_get(id)
        if order is None:
            webapp2.abort(404)

        coupons = model.order_find_coupons(order.order_id)
        coupon_urls = map(lambda c: webapp2.uri_for('coupon', id=c.coupon_id),
                          coupons)

        values = {'order': order,
                  'coupons': zip(coupons, coupon_urls)}
        write_template(self.response, 'accept.html', values)
Exemplo n.º 6
0
    def get(self):
        values = memcache.get('stats')
        if not values:
            byorderstatus = model.order_count_by_status()
            bytype = model.coupon_count_by_type()
            bycouponstatus = model.coupon_count_by_status()

            values = {'orders_by_status': byorderstatus,
                      'coupons_by_type': bytype,
                      'coupons_by_status': bycouponstatus}
            logging.info("Uncached: %s" % values)
            memcache.add('stats', values, 60 * 60 * 24)

        write_template(self.response, "dashboard.html", values)
Exemplo n.º 7
0
 def show_form(self, ct, errors={}):
     values = {'request': self.request.params,
               'coupon_type': ct,
               'errors': errors}
     write_template(self.response, 'order.html', values)
Exemplo n.º 8
0
 def get(self):
     write_template(self.response, 'unconfigured.html')
Exemplo n.º 9
0
 def get(self):
     form = CouponSpawnForm()
     values = {'form': form}
     write_template(self.response, 'coupon_spawn.html', values)
Exemplo n.º 10
0
 def get(self):
     write_template(self.response, 'coupon_list.html', {})
Exemplo n.º 11
0
 def get(self):
     write_template(self.response, 'cancel.html')