示例#1
0
def purchases():
    if get_site_state() == "cancelled":
        return redirect(url_for(".cancellation_refund"))

    purchases = current_user.owned_purchases.filter(
        ~Purchase.state.in_(["cancelled", "reserved"])).order_by(Purchase.id)

    tickets = purchases.filter_by(is_ticket=True).all()
    other_items = purchases.filter_by(is_ticket=False).all()

    payments = (current_user.payments.filter(
        Payment.state != "cancelled").order_by(Payment.state).all())

    if not tickets and not payments:
        return redirect(url_for("tickets.main"))

    transferred_to = current_user.transfers_to.all()
    transferred_from = current_user.transfers_from.all()

    show_receipt = any([t for t in tickets if t.is_paid_for is True])

    return render_template(
        "account/purchases.html",
        tickets=tickets,
        other_items=other_items,
        payments=payments,
        show_receipt=show_receipt,
        transferred_to=transferred_to,
        transferred_from=transferred_from,
    )
示例#2
0
文件: base.py 项目: dominicgs/Website
def main():
    state = get_site_state()
    if app.config.get('DEBUG'):
        state = request.args.get("site_state", state)

    return render_template('home/%s.html' % state,
                           full_price=get_full_price())
示例#3
0
def account():
    if get_site_state() == "cancelled":
        return redirect(url_for(".cancellation_refund"))

    if not current_user.diversity:
        flash(
            "Please check that your user details are correct. "
            "We'd also appreciate it if you could fill in our diversity survey."
        )
        return redirect(url_for(".details"))
    return render_template("account/main.html")
示例#4
0
def main():
    full_price = TicketType.get_price_cheapest_full()
    if not (feature_enabled('BANK_TRANSFER')
            or feature_enabled('GOCARDLESS')) and full_price is not None:
        # Only card payment left
        full_price += StripePayment.premium('GBP', full_price)

    state = get_site_state()
    if app.config.get('DEBUG'):
        state = request.args.get("site_state", state)

    return render_template('home/%s.html' % state, full_price=full_price)
示例#5
0
def main():
    full_price = TicketType.get_price_cheapest_full()
    if not (feature_enabled('BANK_TRANSFER') or feature_enabled('GOCARDLESS')) and full_price is not None:
        # Only card payment left
        full_price += StripePayment.premium('GBP', full_price)

    state = get_site_state()
    if app.config.get('DEBUG'):
        state = request.args.get("site_state", state)

    return render_template('home/%s.html' % state,
                           full_price=full_price)
示例#6
0
    def utility_processor():
        SALES_STATE = get_sales_state()
        SITE_STATE = get_site_state()

        if app.config.get('DEBUG'):
            SITE_STATE = request.args.get("site_state", SITE_STATE)
            SALES_STATE = request.args.get("sales_state", SALES_STATE)

        return dict(SALES_STATE=SALES_STATE,
                    SITE_STATE=SITE_STATE,
                    CURRENCIES=CURRENCIES,
                    CURRENCY_SYMBOLS=CURRENCY_SYMBOLS,
                    external_url=external_url,
                    feature_enabled=feature_enabled)
示例#7
0
    def utility_processor():
        SALES_STATE = get_sales_state()
        SITE_STATE = get_site_state()

        return dict(
            SALES_STATE=SALES_STATE,
            SITE_STATE=SITE_STATE,
            CURRENCIES=CURRENCIES,
            CURRENCY_SYMBOLS=CURRENCY_SYMBOLS,
            external_url=external_url,
            feature_enabled=feature_enabled,
            get_user_currency=get_user_currency,
            year=datetime.utcnow().year,
        )
示例#8
0
    def utility_processor():
        SALES_STATE = get_sales_state()
        SITE_STATE = get_site_state()

        if app.config.get('DEBUG'):
            SITE_STATE = request.args.get("site_state", SITE_STATE)
            SALES_STATE = request.args.get("sales_state", SALES_STATE)

        return dict(
            SALES_STATE=SALES_STATE,
            SITE_STATE=SITE_STATE,
            CURRENCIES=CURRENCIES,
            CURRENCY_SYMBOLS=CURRENCY_SYMBOLS,
            external_url=external_url,
            feature_enabled=feature_enabled
        )
示例#9
0
    def utility_processor():
        SALES_STATE = get_sales_state()
        SITE_STATE = get_site_state()

        if app.config.get("DEBUG"):
            SITE_STATE = request.args.get("site_state", SITE_STATE)
            SALES_STATE = request.args.get("sales_state", SALES_STATE)

        basket_count = len(session.get("basket_purchase_ids", []))

        return dict(
            SALES_STATE=SALES_STATE,
            SITE_STATE=SITE_STATE,
            CURRENCIES=CURRENCIES,
            CURRENCY_SYMBOLS=CURRENCY_SYMBOLS,
            external_url=external_url,
            feature_enabled=feature_enabled,
            basket_count=basket_count,
        )
示例#10
0
    def utility_processor():
        SALES_STATE = get_sales_state()
        SITE_STATE = get_site_state()

        if app.config.get('DEBUG'):
            SITE_STATE = request.args.get("site_state", SITE_STATE)
            SALES_STATE = request.args.get("sales_state", SALES_STATE)

        basket_count = len(session.get('basket_purchase_ids', []))

        return dict(
            SALES_STATE=SALES_STATE,
            SITE_STATE=SITE_STATE,
            CURRENCIES=CURRENCIES,
            CURRENCY_SYMBOLS=CURRENCY_SYMBOLS,
            external_url=external_url,
            feature_enabled=feature_enabled,
            basket_count=basket_count,
        )
示例#11
0
def main():
    state = get_site_state()
    if app.config.get('DEBUG'):
        state = request.args.get("site_state", state)

    return render_template('home/%s.html' % state, full_price=get_full_price())