Exemple #1
0
 def render(self, context, instance, placeholder):
     year, month, day = time.localtime()[:3]
     month_days, entries = get_month_entries(year, month)
     context.update({
         'year': year,
         'month': month,
         'month_days': month_days,
     })
     return context
Exemple #2
0
    def render(self, context, instance, placeholder):
    	year, month, day = time.localtime()[:3]
    	month_days, entries = get_month_entries(year, month)
    	context.update({
			'year': year,
			'month':month,
			'month_days': month_days,
    		})
        return context
Exemple #3
0
def month(request, year, month, change=None):
    """Listing of days in `month`."""
    year, month, redirect = get_correct_year_month_or_redirect(year, month)
 
    if redirect:
        return HttpResponseRedirect(reverse('custom_calendar.views.month', args=(year, month,)) )
    
    cal = calendar.Calendar()
    month_days = cal.itermonthdays(year, month)
    lst, entries = get_month_entries(year, month)
    return render_to_response("custom_calendar/month.html", dict(year=year, month=month,
                        month_days=lst, mname=mnames[month-1], reminders=reminders(request), entries=entries), context_instance=RequestContext(request))
Exemple #4
0
def plugin_month(request, year, month, change=None):
    """Listing of days in `month`."""
    year, month = int(year), int(month)

    # apply next / previous change
    if change in ("next", "prev"):
        now, mdelta = date(year, month, 15), timedelta(days=31)
        if change == "next":   mod = mdelta
        elif change == "prev": mod = -mdelta


        year, month = (now+mod).timetuple()[:2]

    # init variables
    lst = get_month_entries(year, month)

    return render_to_response("custom_calendar/plugin_main.html", dict(year=year, month=month,
                        month_days=lst, mname=mnames[month-1], reminders=reminders(request)), context_instance=RequestContext(request))
Exemple #5
0
def month(request, year, month, change=None):
    """Listing of days in `month`."""
    year, month, redirect = get_correct_year_month_or_redirect(year, month)

    if redirect:
        return HttpResponseRedirect(
            reverse('custom_calendar.views.month', args=(
                year,
                month,
            )))

    cal = calendar.Calendar()
    month_days = cal.itermonthdays(year, month)
    lst, entries = get_month_entries(year, month)
    return render_to_response("custom_calendar/month.html",
                              dict(year=year,
                                   month=month,
                                   month_days=lst,
                                   mname=mnames[month - 1],
                                   reminders=reminders(request),
                                   entries=entries),
                              context_instance=RequestContext(request))
Exemple #6
0
def plugin_month(request, year, month, change=None):
    """Listing of days in `month`."""
    year, month = int(year), int(month)

    # apply next / previous change
    if change in ("next", "prev"):
        now, mdelta = date(year, month, 15), timedelta(days=31)
        if change == "next": mod = mdelta
        elif change == "prev": mod = -mdelta

        year, month = (now + mod).timetuple()[:2]

    # init variables
    lst = get_month_entries(year, month)

    return render_to_response("custom_calendar/plugin_main.html",
                              dict(year=year,
                                   month=month,
                                   month_days=lst,
                                   mname=mnames[month - 1],
                                   reminders=reminders(request)),
                              context_instance=RequestContext(request))