示例#1
0
def get_dict(item_type,paginate=True,intro=False):
    data = Communication.objects.filter(type=item_type).order_by('-date')
    info_dict = {
        'queryset':data,
        'template_name':'comms/list.html',
        'extra_context':{
            'type':get(COMMS_TYPE,item_type).lower(),
            'dates':lambda: Communication.objects.filter(type=item_type).order_by('-date').values_list('date',flat=True),
            'future':lambda: Event.objects.in_future().select_related('type'),
            'intro':intro,
        },
    }
    if paginate:    info_dict['paginate_by'] = 10
    else:           info_dict['date_field'] = 'date'
    return info_dict
示例#2
0
文件: urls.py 项目: esteluk/reinhardt
def get_dict(item_type,paginate=True,intro=False):
    data = Communication.objects.filter(type=item_type).order_by('-date')
    info_dict = {
        'queryset':data,
        'template_name':'comms/list.html',
        'extra_context':{
            'type':get(COMMS_TYPE,item_type).lower(),
            'dates':lambda: lookup(item_type),
            'future':lambda: future_events(),
            'intro':intro,
        },
    }
    if paginate:    info_dict['paginate_by'] = 10
    else:           info_dict['date_field'] = 'date'
    return info_dict