Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
19f98946
Kaydet (Commit)
19f98946
authored
Eyl 06, 2015
tarafından
Alasdair Nicol
Kaydeden (comit)
Tim Graham
Eyl 07, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25358 -- Improved variable name for question in tutorial.
üst
49eee842
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
tutorial03.txt
docs/intro/tutorial03.txt
+1
-1
tutorial04.txt
docs/intro/tutorial04.txt
+5
-5
No files found.
docs/intro/tutorial03.txt
Dosyayı görüntüle @
19f98946
...
...
@@ -177,7 +177,7 @@ commas, according to publication date:
def index(request):
latest_question_list = Question.objects.order_by('-pub_date')[:5]
output = ', '.join([
p.question_text for p
in latest_question_list])
output = ', '.join([
q.question_text for q
in latest_question_list])
return HttpResponse(output)
# Leave the rest of the views (detail, results, vote) unchanged
...
...
docs/intro/tutorial04.txt
Dosyayı görüntüle @
19f98946
...
...
@@ -76,13 +76,13 @@ create a real version. Add the following to ``polls/views.py``:
from .models import Choice, Question
# ...
def vote(request, question_id):
p
= get_object_or_404(Question, pk=question_id)
question
= get_object_or_404(Question, pk=question_id)
try:
selected_choice =
p
.choice_set.get(pk=request.POST['choice'])
selected_choice =
question
.choice_set.get(pk=request.POST['choice'])
except (KeyError, Choice.DoesNotExist):
# Redisplay the question voting form.
return render(request, 'polls/detail.html', {
'question':
p
,
'question':
question
,
'error_message': "You didn't select a choice.",
})
else:
...
...
@@ -91,7 +91,7 @@ create a real version. Add the following to ``polls/views.py``:
# Always return an HttpResponseRedirect after successfully dealing
# with POST data. This prevents data from being posted twice if a
# user hits the Back button.
return HttpResponseRedirect(reverse('polls:results', args=(
p
.id,)))
return HttpResponseRedirect(reverse('polls:results', args=(
question
.id,)))
This code includes a few things we haven't covered yet in this tutorial:
...
...
@@ -135,7 +135,7 @@ This code includes a few things we haven't covered yet in this tutorial:
'/polls/3/results/'
where the ``3`` is the value of ``
p
.id``. This redirected URL will
where the ``3`` is the value of ``
question
.id``. This redirected URL will
then call the ``'results'`` view to display the final page.
As mentioned in :doc:`Tutorial 3 </intro/tutorial03>`, ``request`` is an
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment