diff --git a/docs/howto/outputting-csv.txt b/docs/howto/outputting-csv.txt index f6bc79c630..3c06a72973 100644 --- a/docs/howto/outputting-csv.txt +++ b/docs/howto/outputting-csv.txt @@ -105,7 +105,7 @@ template output the commas in a :ttag:`for` loop. Here's an example, which generates the same CSV file as above:: from django.http import HttpResponse - from django.template import loader, Context + from django.template import Content, loader def some_view(request): # Create the HttpResponse object with the appropriate CSV header. diff --git a/docs/howto/outputting-pdf.txt b/docs/howto/outputting-pdf.txt index 2f33fe8200..fa911df169 100644 --- a/docs/howto/outputting-pdf.txt +++ b/docs/howto/outputting-pdf.txt @@ -46,8 +46,8 @@ objects are file-like objects. Here's a "Hello World" example:: - from reportlab.pdfgen import canvas from django.http import HttpResponse + from reportlab.pdfgen import canvas def some_view(request): # Create the HttpResponse object with the appropriate PDF headers. diff --git a/docs/intro/overview.txt b/docs/intro/overview.txt index 7cf17ba376..e091ab0229 100644 --- a/docs/intro/overview.txt +++ b/docs/intro/overview.txt @@ -69,7 +69,7 @@ necessary: .. code-block:: python # Import the models we created from our "news" app - >>> from news.models import Reporter, Article + >>> from news.models import Article, Reporter # No reporters are in the system yet. >>> Reporter.objects.all() diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt index 12e1a73630..631536b515 100644 --- a/docs/intro/tutorial02.txt +++ b/docs/intro/tutorial02.txt @@ -383,7 +383,7 @@ the Python import path to your :file:`mysite/settings.py` file. Once you're in the shell, explore the :doc:`database API `:: - >>> from polls.models import Question, Choice # Import the model classes we just wrote. + >>> from polls.models import Choice, Question # Import the model classes we just wrote. # No questions are in the system yet. >>> Question.objects.all() @@ -469,7 +469,7 @@ the :doc:`time zone support docs `. Save these changes and start a new Python interactive shell by running ``python manage.py shell`` again:: - >>> from polls.models import Question, Choice + >>> from polls.models import Choice, Question # Make sure our __str__() addition worked. >>> Question.objects.all() diff --git a/docs/intro/tutorial04.txt b/docs/intro/tutorial04.txt index 8e1f8d9aef..65caef3043 100644 --- a/docs/intro/tutorial04.txt +++ b/docs/intro/tutorial04.txt @@ -69,8 +69,8 @@ create a real version. Add the following to ``polls/views.py``: .. snippet:: :filename: polls/views.py + from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, render - from django.http import HttpResponseRedirect, HttpResponse from django.urls import reverse from .models import Choice, Question @@ -262,8 +262,8 @@ views and use Django's generic views instead. To do so, open the .. snippet:: :filename: polls/views.py - from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect + from django.shortcuts import get_object_or_404, render from django.urls import reverse from django.views import generic diff --git a/docs/intro/tutorial05.txt b/docs/intro/tutorial05.txt index 28b79f6962..59fea496ca 100644 --- a/docs/intro/tutorial05.txt +++ b/docs/intro/tutorial05.txt @@ -171,8 +171,8 @@ Put the following in the ``tests.py`` file in the ``polls`` application: import datetime - from django.utils import timezone from django.test import TestCase + from django.utils import timezone from .models import Question diff --git a/docs/ref/class-based-views/generic-display.txt b/docs/ref/class-based-views/generic-display.txt index 15d3351d48..044f16d9e5 100644 --- a/docs/ref/class-based-views/generic-display.txt +++ b/docs/ref/class-based-views/generic-display.txt @@ -38,8 +38,8 @@ many projects they are typically the most commonly used views. **Example myapp/views.py**:: - from django.views.generic.detail import DetailView from django.utils import timezone + from django.views.generic.detail import DetailView from articles.models import Article @@ -107,8 +107,8 @@ many projects they are typically the most commonly used views. **Example views.py**:: - from django.views.generic.list import ListView from django.utils import timezone + from django.views.generic.list import ListView from articles.models import Article diff --git a/docs/ref/class-based-views/generic-editing.txt b/docs/ref/class-based-views/generic-editing.txt index 969a033a31..7979eb19b7 100644 --- a/docs/ref/class-based-views/generic-editing.txt +++ b/docs/ref/class-based-views/generic-editing.txt @@ -15,8 +15,8 @@ editing content: Some of the examples on this page assume that an ``Author`` model has been defined as follows in ``myapp/models.py``:: - from django.urls import reverse from django.db import models + from django.urls import reverse class Author(models.Model): name = models.CharField(max_length=200) @@ -226,8 +226,8 @@ editing content: **Example myapp/views.py**:: - from django.views.generic.edit import DeleteView from django.urls import reverse_lazy + from django.views.generic.edit import DeleteView from myapp.models import Author class AuthorDelete(DeleteView): diff --git a/docs/ref/contrib/admin/actions.txt b/docs/ref/contrib/admin/actions.txt index c23c647a72..0eb6de5b11 100644 --- a/docs/ref/contrib/admin/actions.txt +++ b/docs/ref/contrib/admin/actions.txt @@ -220,8 +220,8 @@ example, you might write a simple export function that uses Django's :doc:`serialization functions ` to dump some selected objects as JSON:: - from django.http import HttpResponse from django.core import serializers + from django.http import HttpResponse def export_as_json(modeladmin, request, queryset): response = HttpResponse(content_type="application/json") diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 29bd436fe0..3cf13572a2 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -128,7 +128,7 @@ The ``register`` decorator argument:: from django.contrib import admin - from .models import Author, Reader, Editor + from .models import Author, Editor, Reader from myproject.admin_site import custom_admin_site @admin.register(Author, Reader, Editor, site=custom_admin_site) @@ -502,12 +502,12 @@ subclass:: that we'd like to use for large text fields instead of the default ``