当前位置: 首页>>代码示例>>Python>>正文


Python ticketing.TicketingManager类代码示例

本文整理汇总了Python中app.helpers.ticketing.TicketingManager的典型用法代码示例。如果您正苦于以下问题:Python TicketingManager类的具体用法?Python TicketingManager怎么用?Python TicketingManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TicketingManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: display_orders

def display_orders(event_id, pdf=None):
    from_date = request.args.get('from_date')
    to_date = request.args.get('to_date')
    discount_code = request.args.get('discount_code')
    if ('from_date' in request.args and not from_date) or ('to_date' in request.args and not to_date) or \
        ('from_date' in request.args and 'to_date' not in request.args) or \
        ('to_date' in request.args and 'from_date' not in request.args):
        return redirect(url_for('.display_orders', event_id=event_id))
    if from_date and to_date:
        orders = TicketingManager.get_orders(
            event_id=event_id,
            from_date=datetime.strptime(from_date, '%d/%m/%Y'),
            to_date=datetime.strptime(to_date, '%d/%m/%Y')
        )
    elif discount_code == '':
        return redirect(url_for('.display_orders', event_id=event_id))
    elif discount_code:
        orders = TicketingManager.get_orders(
            event_id=event_id,
            discount_code=discount_code,
        )
    else:
        orders = TicketingManager.get_orders(event_id)
    event = DataGetter.get_event(event_id)
    if pdf is not None:
        return (event, event_id, orders, discount_code)
    else:
        return render_template('gentelella/users/events/tickets/orders.html', event=event, event_id=event_id,
                               orders=orders, from_date=from_date, to_date=to_date, discount_code=discount_code)
开发者ID:rafalkowalski,项目名称:open-event-orga-server,代码行数:29,代码来源:ticket_sales.py

示例2: apply_promo

def apply_promo():
    discount = TicketingManager.get_discount_code(request.form.get('event_id'), request.form.get('promo_code', ''))
    access_code = TicketingManager.get_access_code(request.form.get('event_id'), request.form.get('promo_code', ''))
    if discount and access_code and discount.is_active:
        return jsonify({
            'discount_type': discount.type,
            'discount_amount': discount.value,
            'discount_status': True,
            'access_status': True,
            'access_code_ticket': access_code.tickets,
            'discount_code_ticket': discount.tickets,
        })
    elif discount and discount.is_active:
        return jsonify({
            'discount_type': discount.type,
            'discount_amount': discount.value,
            'discount_status': True,
            'access_status': False,
            'discount_code_ticket': discount.tickets,
        })
    elif access_code:
        return jsonify({
            'access_status': True,
            'discount_status': False,
            'access_code_ticket': access_code.tickets,
        })
    else:
        return jsonify({
            'discount_status': False,
            'access_status': False,
        })
开发者ID:niranjan94,项目名称:open-event-orga-server,代码行数:31,代码来源:ticketing.py

示例3: access_codes_edit

def access_codes_edit(event_id, access_code_id=None):
    if not TicketingManager.get_access_code(event_id, access_code_id):
        abort(404)
    if request.method == 'POST':
        TicketingManager.create_edit_access_code(request.form, event_id, access_code_id)
        flash("The access code has been edited.", "success")
        return redirect(url_for('.access_codes_view', event_id=event_id))
    return access_codes_create(event_id, access_code_id)
开发者ID:rafalkowalski,项目名称:open-event-orga-server,代码行数:8,代码来源:ticket_sales.py

示例4: fees_by_events_view

def fees_by_events_view():
    from_date = request.args.get('from_date')
    to_date = request.args.get('to_date')

    if ('from_date' in request.args and not from_date) or ('to_date' in request.args and not to_date) or \
        ('from_date' in request.args and 'to_date' not in request.args) or \
        ('to_date' in request.args and 'from_date' not in request.args):
        return redirect(url_for('.fees_by_events_view'))

    marketer_role = CustomSysRole.query.filter_by(name='Marketer').first()
    marketer_id = login.current_user.id if login.current_user.is_sys_role(marketer_role.id) else None

    if from_date and to_date:
        orders = TicketingManager.get_orders(
            from_date=datetime.strptime(from_date, '%d/%m/%Y'),
            to_date=datetime.strptime(to_date, '%d/%m/%Y'),
            status='completed',
            marketer_id=marketer_id
        )
    else:
        orders = TicketingManager.get_orders(status='completed', marketer_id=marketer_id)

    events = DataGetter.get_all_events()

    fee_summary = {}
    for event in events:
        fee_summary[str(event.id)] = {
            'name': event.name,
            'payment_currency': event.payment_currency,
            'fee_rate': get_fee(event.payment_currency),
            'fee_amount': 0,
            'tickets_count': 0
        }

    fee_total = 0
    tickets_total = 0

    for order in orders:
        if order.event:
            for order_ticket in order.tickets:
                fee_summary[str(order.event.id)]['tickets_count'] += order_ticket.quantity
                tickets_total += order_ticket.quantity
                ticket = CachedGetter.get_ticket(order_ticket.ticket_id)
                if order.paid_via != 'free' and order.amount > 0 and ticket.price > 0:
                    fee = ticket.price * (get_fee(order.event.payment_currency) / 100)
                    fee = forex(order.event.payment_currency, display_currency, fee)
                    fee_summary[str(order.event.id)]['fee_amount'] += fee
                    fee_total += fee

    return render_template('gentelella/super_admin/sales/fees.html',
                           fee_summary=fee_summary,
                           display_currency=display_currency,
                           from_date=from_date,
                           to_date=to_date,
                           tickets_total=tickets_total,
                           fee_total=fee_total,
                           navigation_bar=list_navbar())
开发者ID:codebhendi,项目名称:open-event-orga-server,代码行数:57,代码来源:sales.py

示例5: access_codes_create

def access_codes_create(event_id, access_code_id=None):
    event = DataGetter.get_event(event_id)
    if request.method == 'POST':
        TicketingManager.create_edit_access_code(request.form, event_id)
        flash("The access code has been added.", "success")
        return redirect(url_for('.access_codes_view', event_id=event_id))
    access_code = None
    if access_code_id:
        access_code = TicketingManager.get_access_code(event_id, access_code_id)
    return render_template('gentelella/users/events/tickets/access_codes_create.html', event=event, event_id=event_id,
                           access_code=access_code)
开发者ID:rafalkowalski,项目名称:open-event-orga-server,代码行数:11,代码来源:ticket_sales.py

示例6: discount_codes_create

 def discount_codes_create(self, event_id, discount_code_id=None):
     event = DataGetter.get_event(event_id)
     if request.method == 'POST':
         TicketingManager.create_edit_discount_code(request.form, event_id)
         flash("The discount code has been added.", "success")
         return redirect(url_for('.discount_codes_view', event_id=event_id))
     discount_code = None
     if discount_code_id:
         discount_code = TicketingManager.get_discount_code(event_id, discount_code_id)
     return self.render('/gentelella/admin/event/tickets/discount_codes_create.html', event=event, event_id=event_id,
                        discount_code=discount_code)
开发者ID:ashishpahwa7,项目名称:open-event-orga-server,代码行数:11,代码来源:ticket_sales.py

示例7: fees_by_events_view

    def fees_by_events_view(self):
        from_date = request.args.get('from_date')
        to_date = request.args.get('to_date')

        if ('from_date' in request.args and not from_date) or ('to_date' in request.args and not to_date) or \
            ('from_date' in request.args and 'to_date' not in request.args) or \
                ('to_date' in request.args and 'from_date' not in request.args):

            return redirect(url_for('.fees_by_events_view'))

        if from_date and to_date:
            orders = TicketingManager.get_orders(
                from_date=datetime.strptime(from_date, '%d/%m/%Y'),
                to_date=datetime.strptime(to_date, '%d/%m/%Y'),
                status='completed'
            )
        else:
            orders = TicketingManager.get_orders(status='completed')

        events = DataGetter.get_all_events()

        fee_summary = {}
        for event in events:
            fee_summary[str(event.id)] = {
                'name': event.name,
                'payment_currency': event.payment_currency,
                'fee_rate': get_fee(event.payment_currency),
                'fee_amount': 0,
                'tickets_count': 0
            }

        fee_total = 0
        tickets_total = 0

        for order in orders:
            for order_ticket in order.tickets:
                fee_summary[str(order.event.id)]['tickets_count'] += order_ticket.quantity
                tickets_total += order_ticket.quantity
                ticket = TicketingManager.get_ticket(order_ticket.ticket_id)
                if order.paid_via != 'free' and order.amount > 0 and ticket.price > 0:
                    fee = ticket.price * (get_fee(order.event.payment_currency)/100)
                    fee = forex(order.event.payment_currency, self.display_currency, fee)
                    fee_summary[str(order.event.id)]['fee_amount'] += fee
                    fee_total += fee

        return self.render('/gentelella/admin/super_admin/sales/fees.html',
                           fee_summary=fee_summary,
                           display_currency=self.display_currency,
                           from_date=from_date,
                           to_date=to_date,
                           tickets_total=tickets_total,
                           fee_total=fee_total)
开发者ID:ashishpahwa7,项目名称:open-event-orga-server,代码行数:52,代码来源:sales.py

示例8: export

    def export(event_id):
        orders = TicketingManager.get_orders(event_id)
        headers = 'Order#,Order Date, Status, Payment Type, Total Amount, Quantity, Discount Code,' \
            'First Name, Last Name, Email \n'

        rows = [headers]
        for order in orders:
            if order.status != "deleted":
                column = []
                column.append(str(order.get_invoice_number()))
                column.append(str(order.created_at) if order.created_at else '')
                column.append(str(order.status) if order.status else '')
                column.append(str(order.paid_via) if order.paid_via else '')
                column.append(str(order.amount) if order.amount else '')
                column.append(str(order.get_tickets_count()))
                column.append(str(order.discount_code.code) if order.discount_code else '')
                column.append(str(order.user.user_detail.firstname.encode('utf-8'))
                              if order.user.user_detail and order.user.user_detail.firstname else '')
                column.append(str(order.user.user_detail.lastname.encode('utf-8'))
                              if order.user.user_detail and order.user.user_detail.lastname else '')
                column.append(str(order.user.email) if order.user.email else '')
                rows.append(','.join(column))

        csv_content = '\n'.join(rows)

        return csv_content
开发者ID:SaptakS,项目名称:open-event-orga-server,代码行数:26,代码来源:order_csv.py

示例9: access_codes_delete

def access_codes_delete(event_id, access_code_id=None):
    access_code = TicketingManager.get_access_code(event_id, access_code_id)
    if not access_code:
        abort(404)
    delete_from_db(access_code, "Access code deleted")
    flash("The access code has been deleted.", "warning")
    return redirect(url_for('.access_codes_view', event_id=event_id))
开发者ID:rafalkowalski,项目名称:open-event-orga-server,代码行数:7,代码来源:ticket_sales.py

示例10: test_discounts_toggle

 def test_discounts_toggle(self):
     with app.test_request_context():
         event, discount_code = create_discount_code(self)
         response = self.app.get(url_for('event_ticket_sales.discount_codes_toggle', event_id=event.id,
                                         discount_code_id=discount_code.id), follow_redirects=True)
         self.assertFalse(TicketingManager.get_discount_code(event.id, discount_code.id).is_active,
                          msg=response.data)
开发者ID:SaptakS,项目名称:open-event-orga-server,代码行数:7,代码来源:test_tickets_stats.py

示例11: discount_codes_delete

def discount_codes_delete(event_id, discount_code_id=None):
    discount_code = TicketingManager.get_discount_code(event_id, discount_code_id)
    if not discount_code:
        abort(404)
    delete_from_db(discount_code, "Discount code deleted")
    flash("The discount code has been deleted.", "warning")
    return redirect(url_for('.discount_codes_view', event_id=event_id))
开发者ID:rafalkowalski,项目名称:open-event-orga-server,代码行数:7,代码来源:ticket_sales.py

示例12: paypal_callback

def paypal_callback(order_identifier, function):
    order = TicketingManager.get_order_by_identifier(order_identifier)
    if not order or order.status == 'expired':
        abort(404)
    if function == 'cancel':
        order.status = 'expired'
        save_to_db(order)
        return redirect(url_for('event_detail.display_event_detail_home', identifier=order.event.identifier))
    elif function == 'success':
        status, result = TicketingManager.charge_paypal_order_payment(order)
        if status:
            return redirect(url_for('.view_order', order_identifier=order_identifier))
        else:
            flash("An error occurred while processing your transaction. " + str(result), "danger")
            return redirect(url_for('.show_transaction_error', order_identifier=order_identifier))
    abort(404)
开发者ID:niranjan94,项目名称:open-event-orga-server,代码行数:16,代码来源:ticketing.py

示例13: add_order

def add_order(event_id):
    if request.method == 'POST':
        order = TicketingManager.create_order(request.form, True)
        return redirect(url_for('.proceed_order', event_id=event_id, order_identifier=order.identifier))

    event = DataGetter.get_event(event_id)
    return render_template('gentelella/users/events/tickets/add_order.html', event=event, event_id=event_id)
开发者ID:rafalkowalski,项目名称:open-event-orga-server,代码行数:7,代码来源:ticket_sales.py

示例14: display_ticket_stats

def display_ticket_stats(event_id):
    event = DataGetter.get_event(event_id)
    orders = TicketingManager.get_orders(event_id)

    orders_summary = {
        'completed': {
            'class': 'success',
            'tickets_count': 0,
            'orders_count': 0,
            'total_sales': 0
        },
        'pending': {
            'class': 'warning',
            'tickets_count': 0,
            'orders_count': 0,
            'total_sales': 0
        },
        'expired': {
            'class': 'danger',
            'tickets_count': 0,
            'orders_count': 0,
            'total_sales': 0
        }
    }

    tickets_summary = {}

    for ticket in event.tickets:
        tickets_summary[str(ticket.id)] = {
            'name': ticket.name,
            'quantity': ticket.quantity,
            'completed': {
                'tickets_count': 0,
                'sales': 0
            },
            'pending': {
                'tickets_count': 0,
                'sales': 0
            },
            'expired': {
                'class': 'danger',
                'tickets_count': 0,
                'sales': 0
            }
        }

    for order in orders:
        if order.status == 'initialized':
            order.status = 'pending'
        orders_summary[str(order.status)]['orders_count'] += 1
        orders_summary[str(order.status)]['total_sales'] += order.amount
        for order_ticket in order.tickets:
            orders_summary[str(order.status)]['tickets_count'] += order_ticket.quantity
            ticket = get_ticket(order_ticket.ticket_id)
            tickets_summary[str(ticket.id)][str(order.status)]['tickets_count'] += order_ticket.quantity
            if order.paid_via != 'free' and order.amount > 0:
                tickets_summary[str(ticket.id)][str(order.status)]['sales'] += order_ticket.quantity * ticket.price

    return render_template('gentelella/admin/event/tickets/tickets.html', event=event, event_id=event_id,
                           orders_summary=orders_summary, tickets_summary=tickets_summary)
开发者ID:aviaryan,项目名称:open-event-orga-server,代码行数:60,代码来源:ticket_sales.py

示例15: send_event_fee_notification

def send_event_fee_notification():
    with app.app_context():
        events = Event.query.all()
        for event in events:
            latest_invoice = EventInvoice.filter_by(event_id=event.id).order_by(EventInvoice.created_at.desc()).first()

            if latest_invoice:
                orders = Order.query\
                    .filter_by(event_id=event.id)\
                    .filter_by(status='completed')\
                    .filter(Order.completed_at > latest_invoice.created_at).all()
            else:
                orders = Order.query.filter_by(event_id=event.id).filter_by(status='completed').all()

            fee_total = 0
            for order in orders:
                for order_ticket in order.tickets:
                    ticket = TicketingManager.get_ticket(order_ticket.ticket_id)
                    if order.paid_via != 'free' and order.amount > 0 and ticket.price > 0:
                        fee = ticket.price * (get_fee(order.event.payment_currency) / 100)
                        fee_total += fee

            if fee_total > 0:
                new_invoice = EventInvoice(amount=fee_total, event_id=event.id, user_id=event.creator_id)
                save_to_db(new_invoice)
                prev_month = monthdelta(new_invoice.created_at, 1).strftime("%b %Y")  # Displayed as Aug 2016
                send_email_for_monthly_fee_payment(new_invoice.user.email,
                                                   event.name,
                                                   prev_month,
                                                   new_invoice.amount,
                                                   url_for('event_invoicing.view_invoice',
                                                           invoice_identifier=new_invoice.identifier, _external=True))
开发者ID:ashishpahwa7,项目名称:open-event-orga-server,代码行数:32,代码来源:scheduled_jobs.py


注:本文中的app.helpers.ticketing.TicketingManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。