[Answer]-When I am passing this in my view it just displays the html markup. Do I need to pass it in a template tag?

1👍

Try this:

from calendar import HTMLCalendar
from django.shortcuts import render

def foo(request):
    cal = HTMLCalendar()
    calendar = cal.formatmonth(2013, 6)
    return render(request, 'foo.html', { 'calendar': calendar})

or you could even do dict(calendar=calendar)

and in template

{{calendar|safe}}

Leave a comment