Loading docs/intro/reusable-apps.txt +3 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,9 @@ After the previous tutorials, our project should look like this:: polls/ __init__.py admin.py migrations/ __init__.py 0001_initial.py models.py static/ polls/ Loading docs/intro/tutorial01.txt +4 −1 Original line number Diff line number Diff line Loading @@ -704,8 +704,11 @@ demonstration: :filename: polls/models.py import datetime from django.db import models from django.utils import timezone # ... class Question(models.Model): # ... def was_published_recently(self): Loading docs/intro/tutorial02.txt +3 −4 Original line number Diff line number Diff line Loading @@ -275,8 +275,8 @@ with the admin just as we did with ``Question``. That's easy: :filename: polls/admin.py from django.contrib import admin from polls.models import Choice from polls.models import Choice, Question # ... admin.site.register(Choice) Now "Choices" is an available option in the Django admin. The "Add choice" form Loading Loading @@ -319,8 +319,7 @@ registration code to read: class QuestionAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['question_text']}), ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}), ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}), ] inlines = [ChoiceInline] Loading docs/intro/tutorial03.txt +2 −2 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ In the ``polls/urls.py`` file include the following code: from polls import views urlpatterns = [ url(r'^$', views.index, name='index') url(r'^$', views.index, name='index'), ] The next step is to point the root URLconf at the ``polls.urls`` module. In Loading Loading @@ -466,7 +466,7 @@ provides a shortcut. Here's the ``detail()`` view, rewritten: .. snippet:: :filename: polls/views.py from django.shortcuts import render, get_object_or_404 from django.shortcuts import get_object_or_404, render from polls.models import Question # ... Loading docs/intro/tutorial04.txt +1 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ create a real version. Add the following to ``polls/views.py``: from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect, HttpResponse from django.core.urlresolvers import reverse from polls.models import Choice, Question # ... def vote(request, question_id): Loading Loading
docs/intro/reusable-apps.txt +3 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,9 @@ After the previous tutorials, our project should look like this:: polls/ __init__.py admin.py migrations/ __init__.py 0001_initial.py models.py static/ polls/ Loading
docs/intro/tutorial01.txt +4 −1 Original line number Diff line number Diff line Loading @@ -704,8 +704,11 @@ demonstration: :filename: polls/models.py import datetime from django.db import models from django.utils import timezone # ... class Question(models.Model): # ... def was_published_recently(self): Loading
docs/intro/tutorial02.txt +3 −4 Original line number Diff line number Diff line Loading @@ -275,8 +275,8 @@ with the admin just as we did with ``Question``. That's easy: :filename: polls/admin.py from django.contrib import admin from polls.models import Choice from polls.models import Choice, Question # ... admin.site.register(Choice) Now "Choices" is an available option in the Django admin. The "Add choice" form Loading Loading @@ -319,8 +319,7 @@ registration code to read: class QuestionAdmin(admin.ModelAdmin): fieldsets = [ (None, {'fields': ['question_text']}), ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}), ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}), ] inlines = [ChoiceInline] Loading
docs/intro/tutorial03.txt +2 −2 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ In the ``polls/urls.py`` file include the following code: from polls import views urlpatterns = [ url(r'^$', views.index, name='index') url(r'^$', views.index, name='index'), ] The next step is to point the root URLconf at the ``polls.urls`` module. In Loading Loading @@ -466,7 +466,7 @@ provides a shortcut. Here's the ``detail()`` view, rewritten: .. snippet:: :filename: polls/views.py from django.shortcuts import render, get_object_or_404 from django.shortcuts import get_object_or_404, render from polls.models import Question # ... Loading
docs/intro/tutorial04.txt +1 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ create a real version. Add the following to ``polls/views.py``: from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect, HttpResponse from django.core.urlresolvers import reverse from polls.models import Choice, Question # ... def vote(request, question_id): Loading