コード例 #1
0
ファイル: export.py プロジェクト: rkdarst/cavacal
def ical_search(request, name):
    """Return the ical based on a search for 'name'"""
    if 'regex' in request.REQUEST:
        regex = True
    else:
        regex = False
    matches = models.slot_search(name,
                                 shift_id__gt=firstShift.shift_id,
                                 regex=regex)
    matches.order_by('-shift_id')
    #matches = list(matches)
    #matches.sort(key=lambda s: s.shift_id)
    return HttpResponseIcal(matches, name='CAVA - %s'%name)
コード例 #2
0
ファイル: export.py プロジェクト: rkdarst/cavacal
def ical(request):
    ranklist = ranks
    regex = False
    if 'regex' in request.REQUEST:
        regex = True

    form = SearchForm(request.GET)
    if form.is_valid():
        matches = models.slot_search(pattern=form.cleaned_data['q'],
                    shift_id__gte=cava.util.get_current_shift().shift_id,
                    regex=regex)
        matches.order_by('-shift_id')
        matches = matches[:25]
        #matches = list(matches)
        #matches.sort(key=lambda s: -s.shift_id)
    else:
        form = SearchForm()
    t = django.template.loader.get_template("cava/ical.html")
    c = RequestContext(request, locals())
    body = t.render(c)
    return HttpResponse(body)