S
S
Sama Samsonov2017-01-05 12:03:23
Django
Sama Samsonov, 2017-01-05 12:03:23

How to display a calendar in Django?

How to display a calendar in Django?
import calendar
c = calendar.Calendar()
produces this calendar.Calendar object at 0x000000D8D6DCAF98 how to display it correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stepan Krapivin, 2017-01-07
@samuser

More or less like this:

import calendar
from datetime import datetime

c = calendar.HTMLCalendar()
html_out = c.formatmonth(datetime.today().year, datetime.today().month)

pass the html_out variable to the template, and display it in the template via {{ html_out|safe }}

D
Dimonchik, 2017-01-05
@dimonchik2013

insert into the template + handler, you will have a calendar

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question