示例#1
0
def future(request):
    renderdict = get_menu_dict(request)

    subscriptionsizes = []
    subscription_lines = dict({})
    extra_lines = dict({})
    for subscription_size in SubscriptionSizeDao.all_sizes_ordered():
        subscriptionsizes.append(subscription_size.id)
        subscription_lines[subscription_size.id] = {
            'name':
            subscription_size.product.name + '-' + subscription_size.name,
            'future': 0,
            'now': 0
        }
    for extra_subscription in ExtraSubscriptionTypeDao.all_extra_types():
        extra_lines[extra_subscription.name] = {
            'name': extra_subscription.name,
            'future': 0,
            'now': 0
        }
    for subscription in SubscriptionDao.all_active_subscritions():
        for subscription_size in subscriptionsizes:
            subscription_lines[subscription_size][
                'now'] += subscription.subscription_amount(subscription_size)
    for users_subscription in ExtraSubscriptionDao.all_active_extrasubscritions(
    ):
        extra_lines[users_subscription.type.name]['now'] += 1

    for subscription in SubscriptionDao.future_subscriptions():
        for subscription_size in subscriptionsizes:
            subscription_lines[subscription_size][
                'future'] += subscription.subscription_amount_future(
                    subscription_size)
    for users_subscription in ExtraSubscriptionDao.future_extrasubscriptions():
        extra_lines[users_subscription.type.name]['future'] += 1

    renderdict.update({
        'changed': request.GET.get('changed'),
        'subscription_lines': iter(subscription_lines.values()),
        'extra_lines': iter(extra_lines.values()),
    })
    return render(request, 'future.html', renderdict)
示例#2
0
def extra_canceledlist(request):
    render_dict = get_menu_dict(request)
    render_dict.update(get_changedate(request))
    return subscription_management_list(ExtraSubscriptionDao.canceled_extra_subs(), render_dict,
                                        'management_lists/extra_canceledlist.html', request)
示例#3
0
def extra_canceledlist(request):
    return subscription_management_list(ExtraSubscriptionDao.canceled_extra_subs(), get_menu_dict(request), 'extra_canceledlist.html', request)
示例#4
0
def extra_waitinglist(request):
    return subscription_management_list(ExtraSubscriptionDao.waiting_extra_subs(), get_menu_dict(request), 'extra_waitinglist.html', request)