My model name is keybase model and database is stored in mongo DB and object id can be accessed by '_id'. In views i have made object of that view
What i want is to make a delete button which goes in function of views along with object ID that is coming from mongodb
Here is the code of anchor
<a href="{% url 'Keybase_Management_System:Delete_Keybase' {{ i |mongoid:'_id'}} %}" role="button" aria-pressed="true" style="font-size:11px; display: inline;">
i the parameter value and mongoid: '_id' is custom tag that converts object _id to string id now this is showing parsing error that
could not parse the remainder: '{{' from '{{'
What actually works
If i use this {{ i |mongoid:'_id'}}
separately it shows correct results for instance 9kas83n8d893n but i want to move this id as parameter which i am not able to do.
{{ i |mongoid:'_id'}}
works perfectly unless it is sent as as parameter inside anchor tag in href I know there is some sort of syntax error there might be way to send this but i am not able to figure it out
Remove the curly braces and try this below -
<a href="{% url 'Keybase_Management_System:Delete_Keybase' i|mongoid:'_id' %}" role="button" aria-pressed="true" style="font-size:11px; display: inline;">
You should not have curly braces inside {% %}
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.