Commit 234a2e0b authored by Claude Paroz's avatar Claude Paroz
Browse files

Fixed #23866 -- Harmonized refs to Django documentation from code

parent a6f0b6a9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2,13 +2,14 @@ from django.core.exceptions import ImproperlyConfigured

# Want to get everything from the 'normal' models package.
from django.db.models import *  # NOQA
from django.utils.version import get_docs_version

from django.contrib.gis.geos import HAS_GEOS

if not HAS_GEOS:
    raise ImproperlyConfigured(
        "GEOS is required and has not been detected. Are you sure it is installed? "
        "See also https://docs.djangoproject.com/en/stable/ref/contrib/gis/install/geolibs/")
        "See also https://docs.djangoproject.com/en/%s/ref/contrib/gis/install/geolibs/" % get_docs_version())

# Geographic aggregate functions
from django.contrib.gis.db.models.aggregates import *  # NOQA
+3 −2
Original line number Diff line number Diff line
from django.core.management.base import BaseCommand, CommandError
from django.utils import six
from django.conf import settings
from django.db import connections, DEFAULT_DB_ALIAS, migrations
from django.db.migrations.loader import AmbiguityError
@@ -7,6 +6,8 @@ from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.writer import MigrationWriter
from django.db.migrations.optimizer import MigrationOptimizer
from django.db.migrations.migration import SwappableTuple
from django.utils import six
from django.utils.version import get_docs_version


class Command(BaseCommand):
@@ -85,7 +86,7 @@ class Command(BaseCommand):
                raise CommandError(
                    "You cannot squash squashed migrations! Please transition "
                    "it to a normal migration first: "
                    "https://docs.djangoproject.com/en/1.7/topics/migrations/#squashing-migrations"
                    "https://docs.djangoproject.com/en/%s/topics/migrations/#squashing-migrations" % get_docs_version()
                )
            operations.extend(smigration.operations)
            for dependency in smigration.dependencies:
+6 −3
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ from django.conf import settings
from django.core.management.base import CommandError
from django.db import models, router
from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.version import get_docs_version


def check_for_migrations(app_config, connection):
@@ -31,9 +32,11 @@ def sql_create(app_config, style, connection):
    if connection.settings_dict['ENGINE'] == 'django.db.backends.dummy':
        # This must be the "dummy" database backend, which means the user
        # hasn't set ENGINE for the database.
        raise CommandError("Django doesn't know which syntax to use for your SQL statements,\n" +
            "because you haven't properly specified the ENGINE setting for the database.\n" +
            "see: https://docs.djangoproject.com/en/dev/ref/settings/#databases")
        raise CommandError(
            "Django doesn't know which syntax to use for your SQL statements,\n"
            "because you haven't properly specified the ENGINE setting for the database.\n"
            "see: https://docs.djangoproject.com/en/%s/ref/settings/#databases" % get_docs_version()
        )

    # Get installed models, so we generate REFERENCES right.
    # We trim models from the current app so that the sqlreset command does not
+2 −5
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ from django.template import Template, Context
from django.utils import archive
from django.utils.six.moves.urllib.request import urlretrieve
from django.utils._os import rmtree_errorhandler
from django.utils.version import get_docs_version
from django.core.management.base import BaseCommand, CommandError
from django.core.management.utils import handle_extensions

@@ -100,15 +101,11 @@ class TemplateCommand(BaseCommand):
        base_name = '%s_name' % app_or_project
        base_subdir = '%s_template' % app_or_project
        base_directory = '%s_directory' % app_or_project
        if django.VERSION[-2] != 'final':
            docs_version = 'dev'
        else:
            docs_version = '%d.%d' % django.VERSION[:2]

        context = Context(dict(options, **{
            base_name: name,
            base_directory: top_dir,
            'docs_version': docs_version,
            'docs_version': get_docs_version(),
            'django_version': django.__version__,
        }), autoescape=False)

+3 −2
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ from django.conf import settings
from django.utils import six
from django.utils.encoding import force_text, smart_text
from django.utils.module_loading import import_string
from django.utils.version import get_docs_version


class InvalidBasesError(ValueError):
@@ -71,8 +72,8 @@ class ProjectState(object):
                    raise InvalidBasesError(
                        "Cannot resolve bases for %r\nThis can happen if you are inheriting models from an "
                        "app with migrations (e.g. contrib.auth)\n in an app with no migrations; see "
                        "https://docs.djangoproject.com/en/1.7/topics/migrations/#dependencies "
                        "for more" % new_unrendered_models
                        "https://docs.djangoproject.com/en/%s/topics/migrations/#dependencies "
                        "for more" % (new_unrendered_models, get_docs_version())
                    )
                unrendered_models = new_unrendered_models
            # make sure apps has no dangling references
Loading