Hi all, 

I was doing ok 
until 
https://docs.djangoproject.com/en/1.11/intro/tutorial03/#namespacing-url-names 
part. Not sure what happened. 

The error is NoReverseMatch at /poll
"Reverse for 'detail' not found. 'detail' is not a valid view function or 
pattern name."

"Error during template rendering...
In template 
C:\Users\Balan\Documents\GitHub\my_django_code\mysite\polls\templates\polls\index.html,
 
error at line 4

Reverse for 'detail' not found. 'detail' is not a valid view function or 
pattern name.
1 {% if latest_question_list %}
2     <ul>
3     {% for question in latest_question_list %}
4 <li><a href="{% url 'detail' question.id %}">{{ question.question_text 
}}</a></li>
5 {% endfor %}
6     </ul>
7 {% else %}
8     <p>No polls are available.</p>
9 {% endif %}
10 


This is what I have got on "detail.html".
{% if latest_question_list %}
    <ul>
    {% for question in latest_question_list %}
<li><a href="{% url 'polls:detail' question.id %}">{{ 
question.question_text }}</a></li>
{% endfor %}
    </ul>
{% else %}
    <p>No polls are available.</p>
{% endif %}


Can you help please? Thank you. 

On Monday, 16 July 2018 13:22:23 UTC+1, premalatha balan wrote:
>
> Thank you so much. I have corrected the return including the context dict 
> now. Thank you. It has solved it. Thank you again. 
>
> On Monday, 16 July 2018 13:13:08 UTC+1, Jason wrote:
>>
>> two problems: you're just returning a string in your response, not the 
>> template.
>> Nor are you using the context dict anywhere.
>>
>> Look at the example in the tutorial:  
>> https://docs.djangoproject.com/en/2.0/intro/tutorial03/#a-shortcut-render  
>> How does your index method differ from what's there?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/65f33ac1-c9dd-4e10-a27f-59d01fe78b8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to