Skip to content
Advertisement

get mongodb “_id” in django template

My question is related to this question.

I am trying to display all the _id of mongo database in django template from last 2 days but unable to get it.

This is the error:

error

This is the code I am trying:

views.py

JavaScript

product.html

JavaScript

Though, I tried changing the name to static, cache etc, but still no luck.

Advertisement

Answer

template tag written in app/templatetag folder not in view of app.

https://docs.djangoproject.com/en/3.1/howto/custom-template-tags/

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement