Пример #1
0
def index(request):
    '''
        Index shows the current month view of a calendar
        user must be logged in to see this
            '''
    r = HttpResponseRedirect('/accounts/login/')
    loggedin = False
    if request.user.is_authenticated():
        loggedin = True
        user = request.user
        today = date.today()
        cal = DsHTMLCalendar(user.id)
        calHTML = cal.formatmonth(today.year, today.month)
        r = render_to_response('EventsCalendar/index.html', {'loggedin':loggedin,'cal': mark_safe(calHTML)})
    return r
Пример #2
0
def month(request):
    '''
        view the calendar for a specific month
        Month and year should be a post variable
            '''
    r = HttpResponseRedirect('/accounts/login/')
    loggedin = False
    if request.user.is_authenticated():
        loggedin = True
        user = request.user
        r = HttpResponseRedirect('/events/')
        if 'month' in request.POST and 'year' in request.POST:
            month = int(request.POST['month'])
            year = int(request.POST['year'])
            cal = DsHTMLCalendar(user.id)
            calHTML = cal.formatmonth(year, month)
            r = render_to_response('EventsCalendar/index.html', {'loggedin':loggedin,'cal': mark_safe(calHTML)})
    return r