How to pass choice field value in Django Template in a href tag

Submitted 3 years, 7 months ago
Ticket #171
Views 286
Language/Framework Django
Priority Medium
Status Closed

I am trying to pass the CHOICE field value in Django Template in a tag, like below,

<a href="{% url 'blog' obj.get_blog_display %}" >{{ obj.get_blog_display }}</a>

If i pass any column other than this , I am not geting any error. But if i add obj.get_blog_display  CHOICE field value then its not working getting below error,

NoReverseMatch at / 

Kindly someone help me on this issue.

Submitted on Sep 15, 20
add a comment

1 Answer

Found the answer, actually its issue in one of my choice field values, it has "ABC/XYZ' value like this, because of this value my url pattern doesnt fit into that. After I have changed the url pattern and its working.

Submitted 3 years, 7 months ago


Latest Blogs