Saturday, August 29, 2020

Re: Page 3

he is saying about the ")" read what you wrote slowly...........

On Sun, Aug 30, 2020, 03:06 rbarh...@gmail.com <rbarhydtsf@gmail.com> wrote:
In the above problem example, this statement does not seem to work:
```
from django.urls import path
```
why not

On Saturday, August 29, 2020 at 2:29:51 PM UTC-7 rbarh...@gmail.com wrote:
Hmm.  I don't understand what you are saying.

On Friday, August 28, 2020 at 6:56:25 PM UTC-7 bharath...@gmail.com wrote:
Hi,

     You are closing the para thesis before.
      path('<int:question_id>/results/', views.results, name='results'),
This is the correct syntax. All the best 👍

On Sat, 29 Aug 2020, 3:03 am rbarh...@gmail.com, <rbarh...@gmail.com> wrote:
The error message claims invalid syntax and point to the equal sign between name and 'results.'

On Thursday, August 27, 2020 at 5:12:53 PM UTC-7 rbarh...@gmail.com wrote:
My code inspector tells me that "from django.urls import path" is unused so the path statements must not work, I guess.  But the tutorials presents that code.

BTW, it's Maxim who helped

On Thursday, August 27, 2020 at 5:07:38 PM UTC-7 rbarh...@gmail.com wrote:
Thanks to Maxi, I could move on and immediately found a new problem on Part 3.

I have studied this error message for over an hour and cannot figure it out.  Here is the code.  There are two pieces, one in polls/views.py and one in polls/urls.py.
```
polls/views.py
from django.http import HttpResponse

# Create your views here.
def index(request):
return HttpResponse("I have a BIG present for you.")


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


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

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

urls.py;
```
from django.urls import path

from . import views


urlpatterns = [
# ex: /polls/
path('', views.index, name='index'),
# ex: /polls/5
path('<int:question_id>/', views.detail, name='detail'),
# ex: /polls/5/results/
path('<int:question_id>/results/'), views.results, name='results'),
#ex: /polls/5/vote/
path('<int:question_id>/vote/', views.vote, name='vote'),
]
```
produces this error message:
```
 File "/Users/reb/Desktop/PycharmProjects/081920/djangoProject0/mysite/polls/urls.py", line 12
    path('<int:question_id>/results/'), views.results, name='results'),
```
I cannot see the error.  Please help.  Thank you.

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/75c28487-1d92-4488-a9b7-b3e7a8cc2bc5n%40googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f328c218-ba32-4540-8f37-708648c93ef6n%40googlegroups.com.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOecAnyB82TdZT5MbB0_1FMQCPLFz9W_z7wA-qi4c-AoYTxmVQ%40mail.gmail.com.

No comments:

Post a Comment