Monday, September 29, 2014

Re: Newbie Question: Django Tutorial Part 4 - Exception Issue

-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - https://gpgtools.org

iQIcBAEBCgAGBQJUKT8BAAoJEB267zEX1rwQkYIQAJsQXQQjJkk1zq8rrHtrR17D
OSO44XkhSOqF1hMbQjQsNTX+Q2irErl5YJfuqwuHZaHhHiLqkHSzYqlCMnsRVzit
zNTny+q4pv6LfFJ05O43r2GenNlS+rVmyhsAdKKbEKs/7AE17O5KQ+PBvC6qxHWG
2ATyuGZ56gfP0roO/FlFngedlJkPohhdlTe4RVktEQkPgMRRDmSuSoxZQiSybOxs
OBHFOsAeoB9kRYESfewMxOwe6/D+aRb2Taq+HuQlamR4PwwwTIaL2LTwMBshac5x
WR4siorsklZe6ncpVXLC4gp/eJyM8+Spuuq37PPljxKId/IG5OoXfcRjUuqkH0K2
qpffxfrZK7rhhSCv4hJLGRFUT9A3npdtnHWoqPowB8z690qAbGhF6dBqo4y9Q9SE
ouh5PlR7hk1McYecnHa9nKnmzc1DqbFON9lf7vp2ijuThxRhrKcHpubZcdHOyL5p
eFEv+Epve3FRSi13YPTNqbuY+T3cltFkQ3AuKLxGYyfj0xxNnHCMq0kIVebMYb3m
7v+DI6qg2fvZxWS81B61VNMpfUMNm/YYnlm0fhQbecmtaXqBVep8/cJKN9ZODn6f
zhG/WgqtV4xIJiV7bv3pUTzNL9DbojIRTjry9HIR9WwvckRKBeAa/OImvLTcoFcb
FyJEpnC9GdaXkswCR51H
=8EeX
-----END PGP SIGNATURE-----
Hi Zaiks0105,

Do you have the following line in "your polls/templates/polls/detail.html"?

{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}

On 29 Sep 2014, at 12:48, zaiks0105 <lahtin@gmail.com> wrote:

Hi,

I am following Django official tutorial and have unanswered issue at part 4, https://docs.djangoproject.com/en/1.7/intro/tutorial04/. Here is the exception handling code,

    except (KeyError, Choice.DoesNotExist):          # Redisplay the question voting form.          return render(request, 'polls/detail.html', {              'question': p,              'error_message': "You didn't select a choice.",          })

When I run the server and click on [Vote] without selecting a choice, the page does NOT show me the error message. The same voting page comes back as if [Vote] was not clicked.
I checked my lines and everything seems identical per tutorial.

Any help appreciated!
Thanks


--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/69aaa1bb-5371-4aec-ae1f-fb44880e46b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment