Re: Tutorial part 3 help: bulleted-list

2018-07-17 Thread premalatha balan
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 
3 {% for question in latest_question_list %}
4 {{ question.question_text 
}}
5 {% endfor %}
6 
7 {% else %}
8 No polls are available.
9 {% endif %}
10 


This is what I have got on "detail.html".
{% if latest_question_list %}

{% for question in latest_question_list %}
{{ 
question.question_text }}
{% endfor %}

{% else %}
No polls are available.
{% 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.


Re: Tutorial part 3 help: bulleted-list

2018-07-16 Thread premalatha balan
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/059ffa0a-1d90-489f-97fe-8e5a4cd6d09e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial part 3 help: bulleted-list

2018-07-16 Thread Jason
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/c5fb7ef5-4032-45c2-a66f-f02e0ea01391%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial part 3 help: bulleted-list

2018-07-16 Thread premalatha balan
Hi, 

I am having the same problem that it does not display bulleted list, but I 
do not have a typo. Below is what I have got. 

*mysite>>polls>>view.py*

from django.http import HttpResponse
from django.template import loader
from .models import Question

def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
template = loader.get_template('polls/index.html')
context = {
'latest_question_list': latest_question_list,
}
output = ', '.join([q.question_text for q in latest_question_list])
return HttpResponse(output) 

 
*mysite>>polls>>templates>>polls>>index.html*

{% if latest_question_list %}

{% for question in latest_question_list %}
{{ question.question_text 
}}
{% endfor %}

{% else %}
No polls are available.
{% endif %}


*Can anyone help please? Thank you in advance*

On Wednesday, 19 October 2016 00:29:44 UTC+1, Johnny McClung wrote:
>
> Thanks so much everyone. I looked over those files many times and I 
> couldn't see it. 
>
>
>
> On Tuesday, October 18, 2016 at 5:17:55 PM UTC-4, James Schneider wrote:
>>
>>
>>
>> On Tue, Oct 18, 2016 at 11:00 AM, Johnny McClung  
>> wrote:
>>
>>> I have gotten down to the part where the tutorial reads "Load the page 
>>> by pointing your browser at “/polls/”, and you should see a bulleted-list 
>>> containing the “What’s up” question from Tutorial 2. The link points to the 
>>> question’s detail page."
>>>
>>> I do not see a bulleted-list. All I see is "No polls are available."
>>>
>>> This makes me think that I have an error in the if statement in the 
>>> template index.html. However, I can not find the error or why it is not 
>>> showing me the list. Any help would be appreciated. 
>>>
>>
>> The {% if %} statement is fine. 
>>
>>  
>>
>>> mysite>>polls>>templates>>polls>>index.html
>>>
>>> {% if latest_question_list %}
>>> 
>>> {% for quesion in latest_question_list %}
>>>
>>
>> You do have a typo in your {% for %} loop, however.
>>
>>
>>
>>  
>>
>>> def index(request):
>>> latest_question_list = Question.objects.order_by('-pub_date')[:5]
>>> template = loader.get_template('polls/index.html')
>>> context = {'latest_quesion_list': latest_question_list,}
>>> return HttpResponse(template.render(context, request))
>>>
>>>
>> This is where your issue is. Your template context dictionary also has 
>> the same typo as  your  {% for %} loop, so the {% if %} statement is 
>> returning False because the variable it is checking (which is spelled 
>> correctly) doesn't exist.
>>
>> -James
>>
>

-- 
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/1efc7e17-0d93-4697-bb27-37b8b1511d2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial part 3 help: bulleted-list

2016-10-18 Thread Johnny McClung
Thanks so much everyone. I looked over those files many times and I 
couldn't see it. 



On Tuesday, October 18, 2016 at 5:17:55 PM UTC-4, James Schneider wrote:
>
>
>
> On Tue, Oct 18, 2016 at 11:00 AM, Johnny McClung  > wrote:
>
>> I have gotten down to the part where the tutorial reads "Load the page by 
>> pointing your browser at “/polls/”, and you should see a bulleted-list 
>> containing the “What’s up” question from Tutorial 2. The link points to the 
>> question’s detail page."
>>
>> I do not see a bulleted-list. All I see is "No polls are available."
>>
>> This makes me think that I have an error in the if statement in the 
>> template index.html. However, I can not find the error or why it is not 
>> showing me the list. Any help would be appreciated. 
>>
>
> The {% if %} statement is fine. 
>
>  
>
>> mysite>>polls>>templates>>polls>>index.html
>>
>> {% if latest_question_list %}
>> 
>> {% for quesion in latest_question_list %}
>>
>
> You do have a typo in your {% for %} loop, however.
>
>
>
>  
>
>> def index(request):
>> latest_question_list = Question.objects.order_by('-pub_date')[:5]
>> template = loader.get_template('polls/index.html')
>> context = {'latest_quesion_list': latest_question_list,}
>> return HttpResponse(template.render(context, request))
>>
>>
> This is where your issue is. Your template context dictionary also has the 
> same typo as  your  {% for %} loop, so the {% if %} statement is returning 
> False because the variable it is checking (which is spelled correctly) 
> doesn't exist.
>
> -James
>

-- 
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/23054cef-e165-48b6-b75d-87c8dd81830b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial part 3 help: bulleted-list

2016-10-18 Thread James Schneider
On Tue, Oct 18, 2016 at 11:00 AM, Johnny McClung 
wrote:

> I have gotten down to the part where the tutorial reads "Load the page by
> pointing your browser at “/polls/”, and you should see a bulleted-list
> containing the “What’s up” question from Tutorial 2. The link points to the
> question’s detail page."
>
> I do not see a bulleted-list. All I see is "No polls are available."
>
> This makes me think that I have an error in the if statement in the
> template index.html. However, I can not find the error or why it is not
> showing me the list. Any help would be appreciated.
>

The {% if %} statement is fine.



> mysite>>polls>>templates>>polls>>index.html
>
> {% if latest_question_list %}
> 
> {% for quesion in latest_question_list %}
>

You do have a typo in your {% for %} loop, however.





> def index(request):
> latest_question_list = Question.objects.order_by('-pub_date')[:5]
> template = loader.get_template('polls/index.html')
> context = {'latest_quesion_list': latest_question_list,}
> return HttpResponse(template.render(context, request))
>
>
This is where your issue is. Your template context dictionary also has the
same typo as  your  {% for %} loop, so the {% if %} statement is returning
False because the variable it is checking (which is spelled correctly)
doesn't exist.

-James

-- 
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/CA%2Be%2BciV7HOuTkw5Azqoh%2BQmOHoHf%2Bbo1vvRMdfwf0jp2Hk-29w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial part 3 help: bulleted-list

2016-10-18 Thread Vineet Kothari
NYC

On Oct 19, 2016 12:57 AM, "Vijay Khemlani"  wrote:

> You wrote "latest_quesion_list" in the context dictionary key, it should
> be "latest_question_list"
>
> On Tue, Oct 18, 2016 at 3:00 PM, Johnny McClung 
> wrote:
>
>> I have gotten down to the part where the tutorial reads "Load the page by
>> pointing your browser at “/polls/”, and you should see a bulleted-list
>> containing the “What’s up” question from Tutorial 2. The link points to the
>> question’s detail page."
>>
>> I do not see a bulleted-list. All I see is "No polls are available."
>>
>> This makes me think that I have an error in the if statement in the
>> template index.html. However, I can not find the error or why it is not
>> showing me the list. Any help would be appreciated.
>>
>> mysite>>polls>>templates>>polls>>index.html
>>
>> {% if latest_question_list %}
>> 
>> {% for quesion in latest_question_list %}
>> {{ question.question_text
>> }}
>> {% endfor %}
>> 
>> {% else %}
>> No polls are available.
>> {% endif %}
>>
>>
>> mysite>>polls>>urls.py
>> from django.conf.urls import url
>>
>>
>> from . import views
>>
>> urlpatterns = [
>> url(r'^$', views.index, name='index'),
>> url(r'^(?P[0-9]+)/$', views.detail, name='detail'),
>> url(r'^(?P[0-9]+)/results/$', views.results,
>> name='results'),
>> url(r'^(?P[0-9]+)/vote/$', views.vote, name='vote'),
>> ]
>>
>>
>> .
>> mysite>>polls>>views.py
>> from django.shortcuts import render
>>
>> # Create your views here.
>> from django.http import HttpResponse
>> from django.template import loader
>>
>> from .models import Question
>>
>> def index(request):
>> latest_question_list = Question.objects.order_by('-pub_date')[:5]
>> template = loader.get_template('polls/index.html')
>> context = {'latest_quesion_list': latest_question_list,}
>> return HttpResponse(template.render(context, request))
>>
>>
>> def detail(request, question_id):
>> return HttpResponse("You're looking at question %s." % question_id)
>>
>> def results(request, question_id):
>> response = "You're looking at the results of question %s."
>> return HttpResonse(response % question_id)
>>
>> def vote(request, question_id):
>> return HttpResponse("You're voting on question %s." % question_id)
>>
>> --
>> 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/ms
>> gid/django-users/f0899689-fb34-4728-8ec6-7bfc661c348c%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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/CALn3ei3LO9jqt5q7hAycoK5q1iUzt
> jzHQdKrdtmZ%3Dg2VEg6%2B1A%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAAcanss%2BtrRhBSVwXV9UFPot90X8W6uyOkh9bs907RS4s9_PrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Tutorial part 3 help: bulleted-list

2016-10-18 Thread Vijay Khemlani
You wrote "latest_quesion_list" in the context dictionary key, it should be
"latest_question_list"

On Tue, Oct 18, 2016 at 3:00 PM, Johnny McClung  wrote:

> I have gotten down to the part where the tutorial reads "Load the page by
> pointing your browser at “/polls/”, and you should see a bulleted-list
> containing the “What’s up” question from Tutorial 2. The link points to the
> question’s detail page."
>
> I do not see a bulleted-list. All I see is "No polls are available."
>
> This makes me think that I have an error in the if statement in the
> template index.html. However, I can not find the error or why it is not
> showing me the list. Any help would be appreciated.
>
> mysite>>polls>>templates>>polls>>index.html
>
> {% if latest_question_list %}
> 
> {% for quesion in latest_question_list %}
> {{ question.question_text
> }}
> {% endfor %}
> 
> {% else %}
> No polls are available.
> {% endif %}
>
>
> mysite>>polls>>urls.py
> from django.conf.urls import url
>
>
> from . import views
>
> urlpatterns = [
> url(r'^$', views.index, name='index'),
> url(r'^(?P[0-9]+)/$', views.detail, name='detail'),
> url(r'^(?P[0-9]+)/results/$', views.results,
> name='results'),
> url(r'^(?P[0-9]+)/vote/$', views.vote, name='vote'),
> ]
>
>
> .
> mysite>>polls>>views.py
> from django.shortcuts import render
>
> # Create your views here.
> from django.http import HttpResponse
> from django.template import loader
>
> from .models import Question
>
> def index(request):
> latest_question_list = Question.objects.order_by('-pub_date')[:5]
> template = loader.get_template('polls/index.html')
> context = {'latest_quesion_list': latest_question_list,}
> return HttpResponse(template.render(context, request))
>
>
> def detail(request, question_id):
> return HttpResponse("You're looking at question %s." % question_id)
>
> def results(request, question_id):
> response = "You're looking at the results of question %s."
> return HttpResonse(response % question_id)
>
> def vote(request, question_id):
> return HttpResponse("You're voting on question %s." % question_id)
>
> --
> 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/f0899689-fb34-4728-8ec6-7bfc661c348c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CALn3ei3LO9jqt5q7hAycoK5q1iUztjzHQdKrdtmZ%3Dg2VEg6%2B1A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Tutorial part 3 help: bulleted-list

2016-10-18 Thread Johnny McClung
I have gotten down to the part where the tutorial reads "Load the page by 
pointing your browser at “/polls/”, and you should see a bulleted-list 
containing the “What’s up” question from Tutorial 2. The link points to the 
question’s detail page."

I do not see a bulleted-list. All I see is "No polls are available."

This makes me think that I have an error in the if statement in the 
template index.html. However, I can not find the error or why it is not 
showing me the list. Any help would be appreciated. 

mysite>>polls>>templates>>polls>>index.html

{% if latest_question_list %}

{% for quesion in latest_question_list %}
{{ question.question_text 
}}
{% endfor %}

{% else %}
No polls are available.
{% endif %}


mysite>>polls>>urls.py
from django.conf.urls import url


from . import views

urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P[0-9]+)/$', views.detail, name='detail'),
url(r'^(?P[0-9]+)/results/$', views.results, 
name='results'),
url(r'^(?P[0-9]+)/vote/$', views.vote, name='vote'),
]


.
mysite>>polls>>views.py
from django.shortcuts import render

# Create your views here.
from django.http import HttpResponse
from django.template import loader

from .models import Question

def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
template = loader.get_template('polls/index.html')
context = {'latest_quesion_list': latest_question_list,}
return HttpResponse(template.render(context, request))


def detail(request, question_id):
return HttpResponse("You're looking at question %s." % question_id)

def results(request, question_id):
response = "You're looking at the results of question %s."
return HttpResonse(response % question_id)

def vote(request, question_id):
return HttpResponse("You're voting on question %s." % question_id)

-- 
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/f0899689-fb34-4728-8ec6-7bfc661c348c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.