Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CalendarView(generic.TemplateView):
- def get(self, request):
- # use today's date for the calendar
- d = get_date(self.request.GET.get('month', None))
- url = "http://localhost/v1/una_api/"
- params = {'event_year': d.year, 'event_month': d.month}
- r = requests.get(url, params=params)
- events = r.json()
- # Instantiate our calendar class with today's year and date
- cal = Calendar(d.year, d.month)
- # Call the formatmonth method, which returns our calendar as a table
- html_cal = cal.formatmonth(events=events['results'], withyear=True)
- context = {'calendar': mark_safe(html_cal), 'prev_month': prev_month(d), 'next_month': next_month(d)}
- return render(request, "cal/calendar.html", context)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement