Skip to content

Tag: django

Jinja loop.index does not print

When running the following jinja code, I only get “Column info” printed. Why the index does not appears ? Answer It sounds like the template is being treated as a Django template, not a Jinja template. Using {{ loop.index }} should work in a Jinja template, but wouldn’t work in a Django temp…

“no such table” exception

In Django I added models into models.py. After manage.py makemigrations, manage.py migrate raised this exception: django.db.utils.OperationalError: no such table: auth_test_usertranslatorprofile I removed all old migrations and run makemigrations and migrate again which seemed to work. It didn’t help be…

Django attaching events to days in a calendar?

I have built a basic calendar which generates a table with the current month (taken from the URL) using the built-in calendar.Calendar function, but I would like to attach events to the days that are generated. What would be the best way to do that? Currently in my views: And in my template I can call the wee…