Esempio n. 1
0
def overview(request):
    """
    Shows an overview of all items.
    """
    if request.method == 'POST':
        for item in Item.objects.all():
            form = ElementOrderForm(request.POST, prefix="i%d" % item.id)
            if form.is_valid():
                try:
                    item.parent = Item.objects.get( \
                                       id=form.cleaned_data['parent'])
                except Item.DoesNotExist:
                    item.parent = None
                item.weight = form.cleaned_data['weight']
                item.save()

    items = children_list(Item.objects.filter(parent=None).exclude(hidden=True).order_by('weight'))
    items_hidden = children_list(Item.objects.filter(parent=None).exclude(hidden=False).order_by('weight'))
    try:
        overview = is_summary() and not get_active_item()
    except Item.DoesNotExist:
        overview = True
    return {
        'items': items,
        'items_hidden': items_hidden,
        'overview': overview,
        'summary': is_summary(),
        'countdown_visible': config_get('countdown_visible'),
        'countdown_time': config_get('agenda_countdown_time'),
        }
Esempio n. 2
0
def print_agenda(request):
    response = HttpResponse(mimetype='application/pdf')
    filename = u'filename=%s.pdf;' % _("Agenda")
    response['Content-Disposition'] = filename.encode('utf-8')
    doc = SimpleDocTemplate(response)
    story = [Spacer(1,3*cm)]

    doc.title = _("Agenda")
    # print item list
    items = children_list(Item.objects.filter(parent=None).order_by('weight'))
    for item in items:
        if item.hidden is False:
            # print all items"
            if item.parents:
                space = ""
                counter = 0
                for p in item.parents:
                    if counter != 0:
                        space += "      "
                    counter += 1
                story.append(Paragraph(space+item.title, stylesheet['Subitem']))
            else:
                story.append(Paragraph(item.title, stylesheet['Item']))

    doc.build(story, onFirstPage=firstPage, onLaterPages=laterPages)
    return response