Used extlinks for Django's source code.

This commit is contained in:
Tim Graham 2019-03-28 20:32:17 -04:00 committed by GitHub
parent 8e675e2bd8
commit a68c029e22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 31 additions and 58 deletions

View File

@ -46,6 +46,8 @@ extensions = [
extlinks = { extlinks = {
'commit': ('https://github.com/django/django/commit/%s', ''), 'commit': ('https://github.com/django/django/commit/%s', ''),
'cve': ('https://nvd.nist.gov/view/vuln/detail?vulnId=%s', 'CVE-'), 'cve': ('https://nvd.nist.gov/view/vuln/detail?vulnId=%s', 'CVE-'),
# A file or directory. GitHub redirects from blob to tree if needed.
'source': ('https://github.com/django/django/blob/master/%s', ''),
'ticket': ('https://code.djangoproject.com/ticket/%s', '#'), 'ticket': ('https://code.djangoproject.com/ticket/%s', '#'),
} }

View File

@ -74,17 +74,16 @@ newspaper in Lawrence, Kansas, USA. Django's now run by an international
How is Django licensed? How is Django licensed?
======================= =======================
Django is distributed under `the 3-clause BSD license Django is distributed under :source:`the 3-clause BSD license <LICENSE>`. This
<https://github.com/django/django/blob/master/LICENSE>`_. This is an open is an open source license granting broad permissions to modify and redistribute
source license granting broad permissions to modify and redistribute Django. Django.
Why does Django include Python's license file? Why does Django include Python's license file?
============================================== ==============================================
Django includes code from the Python standard library. Python is distributed Django includes code from the Python standard library. Python is distributed
under a permissive open source license. `A copy of the Python license under a permissive open source license. :source:`A copy of the Python license
<https://github.com/django/django/blob/master/LICENSE.python>`_ is <LICENSE.python>` is included with Django for compliance with Python's terms.
included with Django for compliance with Python's terms.
Which sites use Django? Which sites use Django?
======================= =======================
@ -183,15 +182,13 @@ The Django docs are available in the ``docs`` directory of each Django tarball
release. These docs are in reST (reStructuredText) format, and each text file release. These docs are in reST (reStructuredText) format, and each text file
corresponds to a Web page on the official Django site. corresponds to a Web page on the official Django site.
Because the documentation is `stored in revision control`_, you can browse Because the documentation is :source:`stored in revision control <docs>`, you
documentation changes just like you can browse code changes. can browse documentation changes just like you can browse code changes.
Technically, the docs on Django's site are generated from the latest development Technically, the docs on Django's site are generated from the latest development
versions of those reST documents, so the docs on the Django site may offer more versions of those reST documents, so the docs on the Django site may offer more
information than the docs that come with the latest Django release. information than the docs that come with the latest Django release.
.. _stored in revision control: https://github.com/django/django/tree/master/docs/
How do I cite Django? How do I cite Django?
===================== =====================

View File

@ -97,10 +97,8 @@ reasons:
Django APIs or behaviors change. Django APIs or behaviors change.
Django's documentation is kept in the same source control system as its code. It Django's documentation is kept in the same source control system as its code. It
lives in the `docs`_ directory of our Git repository. Each document online is a lives in the :source:`docs` directory of our Git repository. Each document
separate text file in the repository. online is a separate text file in the repository.
.. _docs: https://github.com/django/django/tree/master/docs
Where to get it Where to get it
=============== ===============

View File

@ -213,11 +213,9 @@ Via the Python API
Flatpages are represented by a standard Flatpages are represented by a standard
:doc:`Django model </topics/db/models>`, :doc:`Django model </topics/db/models>`,
which lives in `django/contrib/flatpages/models.py`_. You can access which lives in :source:`django/contrib/flatpages/models.py`. You can access
flatpage objects via the :doc:`Django database API </topics/db/queries>`. flatpage objects via the :doc:`Django database API </topics/db/queries>`.
.. _django/contrib/flatpages/models.py: https://github.com/django/django/blob/master/django/contrib/flatpages/models.py
.. currentmodule:: django.contrib.flatpages .. currentmodule:: django.contrib.flatpages
.. admonition:: Check for duplicate flatpage URLs. .. admonition:: Check for duplicate flatpage URLs.

View File

@ -262,8 +262,8 @@ to be in the units of the field.
in your field definition. in your field definition.
For example, let's say we have a ``SouthTexasCity`` model (from the For example, let's say we have a ``SouthTexasCity`` model (from the
`GeoDjango distance tests`__ ) on a *projected* coordinate system valid for cities :source:`GeoDjango distance tests <tests/gis_tests/distapp/models.py>` ) on a
in southern Texas:: *projected* coordinate system valid for cities in southern Texas::
from django.contrib.gis.db import models from django.contrib.gis.db import models
@ -297,8 +297,6 @@ both. To specify the band index of a raster input on the right hand side, a
Where the band with index 2 (the third band) of the raster ``rst`` would be Where the band with index 2 (the third band) of the raster ``rst`` would be
used for the lookup. used for the lookup.
__ https://github.com/django/django/blob/master/tests/gis_tests/distapp/models.py
.. _compatibility-table: .. _compatibility-table:
Compatibility Tables Compatibility Tables

View File

@ -72,10 +72,8 @@ Via the Python API
.. class:: models.Redirect .. class:: models.Redirect
Redirects are represented by a standard :doc:`Django model </topics/db/models>`, Redirects are represented by a standard :doc:`Django model </topics/db/models>`,
which lives in `django/contrib/redirects/models.py`_. You can access redirect which lives in :source:`django/contrib/redirects/models.py`. You can access
objects via the :doc:`Django database API </topics/db/queries>`. redirect objects via the :doc:`Django database API </topics/db/queries>`.
.. _django/contrib/redirects/models.py: https://github.com/django/django/blob/master/django/contrib/redirects/models.py
Middleware Middleware
========== ==========

View File

@ -892,7 +892,7 @@ The low-level framework
Behind the scenes, the high-level RSS framework uses a lower-level framework Behind the scenes, the high-level RSS framework uses a lower-level framework
for generating feeds' XML. This framework lives in a single module: for generating feeds' XML. This framework lives in a single module:
`django/utils/feedgenerator.py`_. :source:`django/utils/feedgenerator.py`.
You use this framework on your own, for lower-level feed generation. You can You use this framework on your own, for lower-level feed generation. You can
also create custom feed generator subclasses for use with the ``feed_type`` also create custom feed generator subclasses for use with the ``feed_type``
@ -1006,8 +1006,6 @@ For example, to create an Atom 1.0 feed and print it to standard output::
... ...
</feed> </feed>
.. _django/utils/feedgenerator.py: https://github.com/django/django/blob/master/django/utils/feedgenerator.py
.. currentmodule:: django.contrib.syndication .. currentmodule:: django.contrib.syndication
Custom feed generators Custom feed generators

View File

@ -1199,10 +1199,9 @@ Generate squashed migration file without Django version and timestamp header.
Creates a Django app directory structure for the given app name in the current Creates a Django app directory structure for the given app name in the current
directory or the given destination. directory or the given destination.
By default the directory created contains a ``models.py`` file and other app By default, :source:`the new directory <django/conf/app_template>` contains a
template files. (See the `source`_ for more details.) If only the app ``models.py`` file and other app template files. If only the app name is given,
name is given, the app directory will be created in the current working the app directory will be created in the current working directory.
directory.
If the optional destination is provided, Django will use that existing If the optional destination is provided, Django will use that existing
directory rather than creating a new one. You can use '.' to denote the current directory rather than creating a new one. You can use '.' to denote the current
@ -1274,8 +1273,6 @@ files is:
byte-compile invalid ``*.py`` files, template files ending with ``.py-tpl`` byte-compile invalid ``*.py`` files, template files ending with ``.py-tpl``
will be renamed to ``.py``. will be renamed to ``.py``.
.. _source: https://github.com/django/django/tree/master/django/conf/app_template/
``startproject`` ``startproject``
---------------- ----------------
@ -1284,9 +1281,9 @@ files is:
Creates a Django project directory structure for the given project name in Creates a Django project directory structure for the given project name in
the current directory or the given destination. the current directory or the given destination.
By default, the new directory contains ``manage.py`` and a project package By default, :source:`the new directory <django/conf/project_template>` contains
(containing a ``settings.py`` and other files). See the `template source`_ for ``manage.py`` and a project package (containing a ``settings.py`` and other
details. files).
If only the project name is given, both the project directory and project If only the project name is given, both the project directory and project
package will be named ``<projectname>`` and the project directory package will be named ``<projectname>`` and the project directory
@ -1329,8 +1326,6 @@ The :class:`template context <django.template.Context>` used is:
Please also see the :ref:`rendering warning <render_warning>` as mentioned Please also see the :ref:`rendering warning <render_warning>` as mentioned
for :djadmin:`startapp`. for :djadmin:`startapp`.
.. _`template source`: https://github.com/django/django/tree/master/django/conf/project_template/
``test`` ``test``
-------- --------

View File

@ -1158,8 +1158,6 @@ requests being returned as "Bad Request (400)".
The default :file:`settings.py` file created by :djadmin:`django-admin The default :file:`settings.py` file created by :djadmin:`django-admin
startproject <startproject>` sets ``DEBUG = True`` for convenience. startproject <startproject>` sets ``DEBUG = True`` for convenience.
.. _django/views/debug.py: https://github.com/django/django/blob/master/django/views/debug.py
.. setting:: DEBUG_PROPAGATE_EXCEPTIONS .. setting:: DEBUG_PROPAGATE_EXCEPTIONS
``DEBUG_PROPAGATE_EXCEPTIONS`` ``DEBUG_PROPAGATE_EXCEPTIONS``
@ -1810,9 +1808,7 @@ deletes the one.
Default: A list of all available languages. This list is continually growing Default: A list of all available languages. This list is continually growing
and including a copy here would inevitably become rapidly out of date. You can and including a copy here would inevitably become rapidly out of date. You can
see the current list of translated languages by looking in see the current list of translated languages by looking in
``django/conf/global_settings.py`` (or view the `online source`_). :source:`django/conf/global_settings.py`.
.. _online source: https://github.com/django/django/blob/master/django/conf/global_settings.py
The list is a list of two-tuples in the format The list is a list of two-tuples in the format
(:term:`language code<language code>`, ``language name``) -- for example, (:term:`language code<language code>`, ``language name``) -- for example,
@ -1891,9 +1887,7 @@ errors to an email log handler when :setting:`DEBUG` is ``False``. See also
:ref:`configuring-logging`. :ref:`configuring-logging`.
You can see the default logging configuration by looking in You can see the default logging configuration by looking in
``django/utils/log.py`` (or view the `online source`__). :source:`django/utils/log.py`.
__ https://github.com/django/django/blob/master/django/utils/log.py
.. setting:: LOGGING_CONFIG .. setting:: LOGGING_CONFIG

View File

@ -1026,9 +1026,8 @@ Loader methods
.. admonition:: Building your own .. admonition:: Building your own
For examples, `read the source code for Django's built-in loaders`_. For examples, read the :source:`source code for Django's built-in loaders
<django/template/loaders>`.
.. _read the source code for Django's built-in loaders: https://github.com/django/django/tree/master/django/template/loaders
.. currentmodule:: django.template.base .. currentmodule:: django.template.base

View File

@ -204,14 +204,12 @@ Notice that in addition to the same arguments given to the associated
all take the user object, which may be an anonymous user, as an argument. all take the user object, which may be an anonymous user, as an argument.
A full authorization implementation can be found in the ``ModelBackend`` class A full authorization implementation can be found in the ``ModelBackend`` class
in `django/contrib/auth/backends.py`_, which is the default backend and queries in :source:`django/contrib/auth/backends.py`, which is the default backend and
the ``auth_permission`` table most of the time. If you wish to provide queries the ``auth_permission`` table most of the time. If you wish to provide
custom behavior for only part of the backend API, you can take advantage of custom behavior for only part of the backend API, you can take advantage of
Python inheritance and subclass ``ModelBackend`` instead of implementing the Python inheritance and subclass ``ModelBackend`` instead of implementing the
complete API in a custom backend. complete API in a custom backend.
.. _django/contrib/auth/backends.py: https://github.com/django/django/blob/master/django/contrib/auth/backends.py
.. _anonymous_auth: .. _anonymous_auth:
Authorization for anonymous users Authorization for anonymous users

View File

@ -867,10 +867,8 @@ precede the definition of any keyword arguments. For example::
.. seealso:: .. seealso::
The `OR lookups examples`_ in the Django unit tests show some possible uses The :source:`OR lookups examples <tests/or_lookups/tests.py>` in Django's
of ``Q``. unit tests show some possible uses of ``Q``.
.. _OR lookups examples: https://github.com/django/django/blob/master/tests/or_lookups/tests.py
Comparing objects Comparing objects
================= =================