From 87d55081ea398c65b2503d22ed3907a9175ec729 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 27 Jul 2015 08:35:21 -0400 Subject: [PATCH] Fixed #25159 -- Removed brackets from class/function/method signatures in docs. Thanks hellbeast for the initial patch. --- docs/ref/contrib/admin/actions.txt | 2 +- docs/ref/contrib/admin/index.txt | 4 +- docs/ref/contrib/contenttypes.txt | 4 +- docs/ref/contrib/gis/gdal.txt | 8 ++-- docs/ref/contrib/gis/geoip.txt | 2 +- docs/ref/contrib/gis/geoquerysets.txt | 2 +- docs/ref/contrib/gis/geos.txt | 4 +- docs/ref/contrib/gis/layermapping.txt | 4 +- docs/ref/contrib/gis/ogrinspect.txt | 4 +- docs/ref/files/file.txt | 14 +++---- docs/ref/files/storage.txt | 4 +- docs/ref/models/fields.txt | 54 +++++++++++++-------------- docs/ref/models/instances.txt | 4 +- docs/ref/models/lookups.txt | 2 +- docs/ref/models/querysets.txt | 4 +- docs/ref/models/relations.txt | 4 +- docs/ref/request-response.txt | 2 +- docs/ref/templates/api.txt | 6 +-- docs/ref/urlresolvers.txt | 4 +- docs/ref/urls.txt | 4 +- docs/ref/utils.txt | 4 +- docs/ref/validators.txt | 6 +-- docs/topics/auth/default.txt | 28 +++++++------- docs/topics/email.txt | 2 +- docs/topics/http/shortcuts.txt | 6 +-- docs/topics/signals.txt | 6 +-- docs/topics/templates.txt | 6 +-- docs/topics/testing/advanced.txt | 4 +- 28 files changed, 99 insertions(+), 99 deletions(-) diff --git a/docs/ref/contrib/admin/actions.txt b/docs/ref/contrib/admin/actions.txt index b3d9f0eb0d..197e27a089 100644 --- a/docs/ref/contrib/admin/actions.txt +++ b/docs/ref/contrib/admin/actions.txt @@ -257,7 +257,7 @@ Writing this view is left as an exercise to the reader. Making actions available site-wide ---------------------------------- -.. method:: AdminSite.add_action(action[, name]) +.. method:: AdminSite.add_action(action, name=None) Some actions are best if they're made available to *any* object in the admin site -- the export action defined above would be a good candidate. You can diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 15c9eefd60..6ade38064c 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -101,7 +101,7 @@ Other topics The register decorator ---------------------- -.. function:: register(*models, [site=django.admin.sites.site]) +.. function:: register(*models, site=django.admin.sites.site) There is also a decorator for registering your ``ModelAdmin`` classes:: @@ -2830,7 +2830,7 @@ supplied by the admin views for the current model. The ``staff_member_required`` decorator ======================================= -.. function:: staff_member_required([redirect_field_name=REDIRECT_FIELD_NAME, login_url='admin:login']) +.. function:: staff_member_required(redirect_field_name='next', login_url='admin:login') This decorator is used on the admin views that require authorization. A view decorated with this function will having the following behavior: diff --git a/docs/ref/contrib/contenttypes.txt b/docs/ref/contrib/contenttypes.txt index ef50f84ce8..431c3094f1 100644 --- a/docs/ref/contrib/contenttypes.txt +++ b/docs/ref/contrib/contenttypes.txt @@ -196,7 +196,7 @@ The ``ContentTypeManager`` it's preferred to use this method over the usual ``ContentType.objects.get(pk=id)`` - .. method:: get_for_model(model[, for_concrete_model=True]) + .. method:: get_for_model(model, for_concrete_model=True) Takes either a model class or an instance of a model, and returns the :class:`~django.contrib.contenttypes.models.ContentType` instance @@ -204,7 +204,7 @@ The ``ContentTypeManager`` the :class:`~django.contrib.contenttypes.models.ContentType` of a proxy model. - .. method:: get_for_models(*models[, for_concrete_models=True]) + .. method:: get_for_models(*models, for_concrete_models=True) Takes a variadic number of model classes, and returns a dictionary mapping the model classes to the diff --git a/docs/ref/contrib/gis/gdal.txt b/docs/ref/contrib/gis/gdal.txt index 4b68054a75..0653edab7a 100644 --- a/docs/ref/contrib/gis/gdal.txt +++ b/docs/ref/contrib/gis/gdal.txt @@ -58,7 +58,7 @@ points, polygons, etc.), as well as the names and types of any additional fields (:class:`Field`) of data that may be associated with each feature in that layer. -.. class:: DataSource(ds_input, [encoding='utf-8']) +.. class:: DataSource(ds_input, encoding='utf-8') The constructor for ``DataSource`` only requires one parameter: the path of the file you want to read. However, OGR @@ -244,7 +244,7 @@ __ http://www.gdal.org/ogr/ogr_formats.html >>> layer.get_fields('Name') ['Pueblo', 'Lawrence', 'Houston'] - .. method:: get_geoms([geos=False]) + .. method:: get_geoms(geos=False) A method that returns a list containing the geometry of each feature in the layer. If the optional argument ``geos`` is set to ``True`` @@ -445,7 +445,7 @@ systems and coordinate transformation:: >>> from django.contrib.gis.gdal import OGRGeometry >>> polygon = OGRGeometry('POLYGON((0 0, 5 0, 5 5, 0 5))') -.. class:: OGRGeometry(geom_input[, srs=None]) +.. class:: OGRGeometry(geom_input, srs=None) This object is a wrapper for the `OGR Geometry`__ class. These objects are instantiated directly from the given ``geom_input`` @@ -1416,7 +1416,7 @@ blue. This property can now be set as well. - .. method:: datatype([as_string=False]) + .. method:: datatype(as_string=False) The data type contained in the band, as an integer constant between 0 (Unknown) and 11. If ``as_string`` is ``True``, the data type is diff --git a/docs/ref/contrib/gis/geoip.txt b/docs/ref/contrib/gis/geoip.txt index 424d124573..0fb7fde99c 100644 --- a/docs/ref/contrib/gis/geoip.txt +++ b/docs/ref/contrib/gis/geoip.txt @@ -89,7 +89,7 @@ Defaults to ``'GeoLiteCity.dat'``. ``GeoIP`` API ============= -.. class:: GeoIP([path=None, cache=0, country=None, city=None]) +.. class:: GeoIP(path=None, cache=0, country=None, city=None) The ``GeoIP`` object does not require any parameters to use the default settings. However, at the very least the :setting:`GEOIP_PATH` setting diff --git a/docs/ref/contrib/gis/geoquerysets.txt b/docs/ref/contrib/gis/geoquerysets.txt index ae801c8581..9a93c9dbe8 100644 --- a/docs/ref/contrib/gis/geoquerysets.txt +++ b/docs/ref/contrib/gis/geoquerysets.txt @@ -4,7 +4,7 @@ GeoQuerySet API Reference .. currentmodule:: django.contrib.gis.db.models -.. class:: GeoQuerySet([model=None]) +.. class:: GeoQuerySet(model=None) .. _spatial-lookups: diff --git a/docs/ref/contrib/gis/geos.txt b/docs/ref/contrib/gis/geos.txt index 9ffda83b4e..d2e4bafe00 100644 --- a/docs/ref/contrib/gis/geos.txt +++ b/docs/ref/contrib/gis/geos.txt @@ -138,7 +138,7 @@ Geometry Objects ``GEOSGeometry`` ---------------- -.. class:: GEOSGeometry(geo_input[, srid=None]) +.. class:: GEOSGeometry(geo_input, srid=None) :param geo_input: Geometry input value (string or buffer) :param srid: spatial reference identifier @@ -782,7 +782,7 @@ Example:: >>> from django.contrib.gis.geos import fromfile >>> g = fromfile('/home/bob/geom.wkt') -.. function:: fromstr(string, [,srid=None]) +.. function:: fromstr(string, srid=None) :param string: string that contains spatial data :type string: string diff --git a/docs/ref/contrib/gis/layermapping.txt b/docs/ref/contrib/gis/layermapping.txt index 14f93307f8..69589b05c3 100644 --- a/docs/ref/contrib/gis/layermapping.txt +++ b/docs/ref/contrib/gis/layermapping.txt @@ -85,7 +85,7 @@ system is defined for the layer, use the ``source_srs`` keyword with a ``LayerMapping`` API ==================== -.. class:: LayerMapping(model, data_source, mapping[, layer=0, source_srs=None, encoding=None, transaction_mode='commit_on_success', transform=True, unique=True, using='default']) +.. class:: LayerMapping(model, data_source, mapping, layer=0, source_srs=None, encoding=None, transaction_mode='commit_on_success', transform=True, unique=True, using='default') The following are the arguments and keywords that may be used during instantiation of ``LayerMapping`` objects. @@ -146,7 +146,7 @@ Keyword Arguments ``save()`` Keyword Arguments ---------------------------- -.. method:: LayerMapping.save([verbose=False, fid_range=False, step=False, progress=False, silent=False, stream=sys.stdout, strict=False]) +.. method:: LayerMapping.save(verbose=False, fid_range=False, step=False, progress=False, silent=False, stream=sys.stdout, strict=False) The ``save()`` method also accepts keywords. These keywords are used for controlling output logging, error handling, and for importing diff --git a/docs/ref/contrib/gis/ogrinspect.txt b/docs/ref/contrib/gis/ogrinspect.txt index ffaf8f7e37..653002418b 100644 --- a/docs/ref/contrib/gis/ogrinspect.txt +++ b/docs/ref/contrib/gis/ogrinspect.txt @@ -10,10 +10,10 @@ OGR Inspection ``ogrinspect`` ============== -.. function:: ogrinspect(data_source, model_name[, **kwargs]) +.. function:: ogrinspect(data_source, model_name, **kwargs) :noindex: ``mapping`` =========== -.. function:: mapping(data_source, [geom_name='geom', layer_key=0, multi_geom=False]) +.. function:: mapping(data_source, geom_name='geom', layer_key=0, multi_geom=False) diff --git a/docs/ref/files/file.txt b/docs/ref/files/file.txt index 74343d10f8..14efb83fe6 100644 --- a/docs/ref/files/file.txt +++ b/docs/ref/files/file.txt @@ -34,7 +34,7 @@ The ``File`` Class The read/write mode for the file. - .. method:: open([mode=None]) + .. method:: open(mode=None) Open or reopen the file (which also does ``File.seek(0)``). The ``mode`` argument allows the same values @@ -44,7 +44,7 @@ The ``File`` Class was originally opened with; ``None`` means to reopen with the original mode. - .. method:: read([num_bytes=None]) + .. method:: read(num_bytes=None) Read content from the file. The optional ``size`` is the number of bytes to read; if not specified, the file will be read to the end. @@ -62,7 +62,7 @@ The ``File`` Class .. _universal newlines: https://www.python.org/dev/peps/pep-0278 - .. method:: chunks([chunk_size=None]) + .. method:: chunks(chunk_size=None) Iterate over the file yielding "chunks" of a given size. ``chunk_size`` defaults to 64 KB. @@ -70,12 +70,12 @@ The ``File`` Class This is especially useful with very large files since it allows them to be streamed off disk and avoids storing the whole file in memory. - .. method:: multiple_chunks([chunk_size=None]) + .. method:: multiple_chunks(chunk_size=None) Returns ``True`` if the file is large enough to require multiple chunks to access all of its content give some ``chunk_size``. - .. method:: write([content]) + .. method:: write(content) Writes the specified content string to the file. Depending on the storage system behind the scenes, this content might not be fully @@ -141,7 +141,7 @@ Additional methods on files attached to objects Any :class:`File` that is associated with an object (as with ``Car.photo``, below) will also have a couple of extra methods: -.. method:: File.save(name, content, [save=True]) +.. method:: File.save(name, content, save=True) Saves a new file with the file name and contents provided. This will not replace the existing file, but will create a new file and update the object @@ -159,7 +159,7 @@ below) will also have a couple of extra methods: :class:`File` or of a subclass of :class:`File`, such as :class:`~django.core.files.base.ContentFile`. -.. method:: File.delete([save=True]) +.. method:: File.delete(save=True) Removes the file from the model instance and deletes the underlying file. If ``save`` is ``True``, the model's ``save()`` method will be called once diff --git a/docs/ref/files/storage.txt b/docs/ref/files/storage.txt index ad5616c0dd..8dd700484d 100644 --- a/docs/ref/files/storage.txt +++ b/docs/ref/files/storage.txt @@ -15,7 +15,7 @@ Django provides two convenient ways to access the current storage class: :setting:`DEFAULT_FILE_STORAGE`. :class:`DefaultStorage` uses :func:`~django.core.files.storage.get_storage_class` internally. -.. function:: get_storage_class([import_path=None]) +.. function:: get_storage_class(import_path=None) Returns a class or module which implements the storage API. @@ -29,7 +29,7 @@ Django provides two convenient ways to access the current storage class: The FileSystemStorage Class --------------------------- -.. class:: FileSystemStorage([location=None, base_url=None, file_permissions_mode=None, directory_permissions_mode=None]) +.. class:: FileSystemStorage(location=None, base_url=None, file_permissions_mode=None, directory_permissions_mode=None) The :class:`~django.core.files.storage.FileSystemStorage` class implements basic file storage on a local filesystem. It inherits from diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 7243276305..0921fda6d8 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -396,7 +396,7 @@ otherwise. See :ref:`automatic-primary-key-fields`. ``BigIntegerField`` ------------------- -.. class:: BigIntegerField([**options]) +.. class:: BigIntegerField(**options) A 64 bit integer, much like an :class:`IntegerField` except that it is guaranteed to fit numbers from ``-9223372036854775808`` to @@ -406,7 +406,7 @@ guaranteed to fit numbers from ``-9223372036854775808`` to ``BinaryField`` ------------------- -.. class:: BinaryField([**options]) +.. class:: BinaryField(**options) A field to store raw binary data. It only supports ``bytes`` assignment. Be aware that this field has limited functionality. For example, it is not possible @@ -437,7 +437,7 @@ isn't defined. ``CharField`` ------------- -.. class:: CharField(max_length=None, [**options]) +.. class:: CharField(max_length=None, **options) A string field, for small- to large-sized strings. @@ -470,7 +470,7 @@ The default form widget for this field is a :class:`~django.forms.TextInput`. ``CommaSeparatedIntegerField`` ------------------------------ -.. class:: CommaSeparatedIntegerField(max_length=None, [**options]) +.. class:: CommaSeparatedIntegerField(max_length=None, **options) A field of integers separated by commas. As in :class:`CharField`, the :attr:`~CharField.max_length` argument is required and the note about database @@ -479,7 +479,7 @@ portability mentioned there should be heeded. ``DateField`` ------------- -.. class:: DateField([auto_now=False, auto_now_add=False, **options]) +.. class:: DateField(auto_now=False, auto_now_add=False, **options) A date, represented in Python by a ``datetime.date`` instance. Has a few extra, optional arguments: @@ -525,7 +525,7 @@ Any combination of these options will result in an error. ``DateTimeField`` ----------------- -.. class:: DateTimeField([auto_now=False, auto_now_add=False, **options]) +.. class:: DateTimeField(auto_now=False, auto_now_add=False, **options) A date and time, represented in Python by a ``datetime.datetime`` instance. Takes the same extra arguments as :class:`DateField`. @@ -537,7 +537,7 @@ The default form widget for this field is a single ``DecimalField`` ---------------- -.. class:: DecimalField(max_digits=None, decimal_places=None, [**options]) +.. class:: DecimalField(max_digits=None, decimal_places=None, **options) A fixed-precision decimal number, represented in Python by a :class:`~decimal.Decimal` instance. Has two **required** arguments: @@ -576,7 +576,7 @@ when :attr:`~django.forms.Field.localize` is ``False`` or .. versionadded:: 1.8 -.. class:: DurationField([**options]) +.. class:: DurationField(**options) A field for storing periods of time - modeled in Python by :class:`~python:datetime.timedelta`. When used on PostgreSQL, the data type @@ -592,7 +592,7 @@ SECOND(6)``. Otherwise a ``bigint`` of microseconds is used. ``EmailField`` -------------- -.. class:: EmailField([max_length=254, **options]) +.. class:: EmailField(max_length=254, **options) A :class:`CharField` that checks that the value is a valid email address. It uses :class:`~django.core.validators.EmailValidator` to validate the input. @@ -605,7 +605,7 @@ uses :class:`~django.core.validators.EmailValidator` to validate the input. ``FileField`` ------------- -.. class:: FileField([upload_to=None, max_length=100, **options]) +.. class:: FileField(upload_to=None, max_length=100, **options) A file-upload field. @@ -821,7 +821,7 @@ periodically via e.g. cron). ``FilePathField`` ----------------- -.. class:: FilePathField(path=None, [match=None, recursive=False, max_length=100, **options]) +.. class:: FilePathField(path=None, match=None, recursive=False, max_length=100, **options) A :class:`CharField` whose choices are limited to the filenames in a certain directory on the filesystem. Has three special arguments, of which the first is @@ -874,7 +874,7 @@ can change the maximum length using the :attr:`~CharField.max_length` argument. ``FloatField`` -------------- -.. class:: FloatField([**options]) +.. class:: FloatField(**options) A floating-point number represented in Python by a ``float`` instance. @@ -896,7 +896,7 @@ when :attr:`~django.forms.Field.localize` is ``False`` or ``ImageField`` -------------- -.. class:: ImageField([upload_to=None, height_field=None, width_field=None, max_length=100, **options]) +.. class:: ImageField(upload_to=None, height_field=None, width_field=None, max_length=100, **options) Inherits all attributes and methods from :class:`FileField`, but also validates that the uploaded object is a valid image. @@ -931,7 +931,7 @@ The default form widget for this field is a ``IntegerField`` ---------------- -.. class:: IntegerField([**options]) +.. class:: IntegerField(**options) An integer. Values from ``-2147483648`` to ``2147483647`` are safe in all databases supported by Django. The default form widget for this field is a @@ -941,7 +941,7 @@ is ``False`` or :class:`~django.forms.TextInput` otherwise. ``GenericIPAddressField`` ------------------------- -.. class:: GenericIPAddressField([protocol=both, unpack_ipv4=False, **options]) +.. class:: GenericIPAddressField(protocol=both, unpack_ipv4=False, **options) An IPv4 or IPv6 address, in string format (e.g. ``192.0.2.30`` or ``2a02:42fe::4``). The default form widget for this field is a @@ -972,7 +972,7 @@ values are stored as null. ``NullBooleanField`` -------------------- -.. class:: NullBooleanField([**options]) +.. class:: NullBooleanField(**options) Like a :class:`BooleanField`, but allows ``NULL`` as one of the options. Use this instead of a :class:`BooleanField` with ``null=True``. The default form @@ -981,7 +981,7 @@ widget for this field is a :class:`~django.forms.NullBooleanSelect`. ``PositiveIntegerField`` ------------------------ -.. class:: PositiveIntegerField([**options]) +.. class:: PositiveIntegerField(**options) Like an :class:`IntegerField`, but must be either positive or zero (``0``). Values from ``0`` to ``2147483647`` are safe in all databases supported by @@ -990,7 +990,7 @@ Django. The value ``0`` is accepted for backward compatibility reasons. ``PositiveSmallIntegerField`` ----------------------------- -.. class:: PositiveSmallIntegerField([**options]) +.. class:: PositiveSmallIntegerField(**options) Like a :class:`PositiveIntegerField`, but only allows values under a certain (database-dependent) point. Values from ``0`` to ``32767`` are safe in all @@ -999,7 +999,7 @@ databases supported by Django. ``SlugField`` ------------- -.. class:: SlugField([max_length=50, **options]) +.. class:: SlugField(max_length=50, **options) :term:`Slug` is a newspaper term. A slug is a short label for something, containing only letters, numbers, underscores or hyphens. They're generally used @@ -1026,7 +1026,7 @@ of some other value. You can do this automatically in the admin using ``SmallIntegerField`` --------------------- -.. class:: SmallIntegerField([**options]) +.. class:: SmallIntegerField(**options) Like an :class:`IntegerField`, but only allows values under a certain (database-dependent) point. Values from ``-32768`` to ``32767`` are safe in all @@ -1035,7 +1035,7 @@ databases supported by Django. ``TextField`` ------------- -.. class:: TextField([**options]) +.. class:: TextField(**options) A large text field. The default form widget for this field is a :class:`~django.forms.Textarea`. @@ -1055,7 +1055,7 @@ However it is not enforced at the model or database level. Use a ``TimeField`` ------------- -.. class:: TimeField([auto_now=False, auto_now_add=False, **options]) +.. class:: TimeField(auto_now=False, auto_now_add=False, **options) A time, represented in Python by a ``datetime.time`` instance. Accepts the same auto-population options as :class:`DateField`. @@ -1066,7 +1066,7 @@ The admin adds some JavaScript shortcuts. ``URLField`` ------------ -.. class:: URLField([max_length=200, **options]) +.. class:: URLField(max_length=200, **options) A :class:`CharField` for a URL. @@ -1081,7 +1081,7 @@ Like all :class:`CharField` subclasses, :class:`URLField` takes the optional .. versionadded:: 1.8 -.. class:: UUIDField([**options]) +.. class:: UUIDField(**options) A field for storing universally unique identifiers. Uses Python's :class:`~python:uuid.UUID` class. When used on PostgreSQL, this stores in a @@ -1116,7 +1116,7 @@ Django also defines a set of fields that represent relations. ``ForeignKey`` -------------- -.. class:: ForeignKey(othermodel, [**options]) +.. class:: ForeignKey(othermodel, **options) A many-to-one relationship. Requires a positional argument: the class to which the model is related. @@ -1374,7 +1374,7 @@ The possible values for :attr:`~ForeignKey.on_delete` are found in ``ManyToManyField`` ------------------- -.. class:: ManyToManyField(othermodel, [**options]) +.. class:: ManyToManyField(othermodel, **options) A many-to-many relationship. Requires a positional argument: the class to which the model is related, which works exactly the same as it does for @@ -1577,7 +1577,7 @@ relationship at the database level. ``OneToOneField`` ----------------- -.. class:: OneToOneField(othermodel, [parent_link=False, **options]) +.. class:: OneToOneField(othermodel, parent_link=False, **options) A one-to-one relationship. Conceptually, this is similar to a :class:`ForeignKey` with :attr:`unique=True `, but the diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index 9fa5318a9f..867e30a6fc 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -312,7 +312,7 @@ Saving objects To save an object back to the database, call ``save()``: -.. method:: Model.save([force_insert=False, force_update=False, using=DEFAULT_DB_ALIAS, update_fields=None]) +.. method:: Model.save(force_insert=False, force_update=False, using=DEFAULT_DB_ALIAS, update_fields=None) If you want customized saving behavior, you can override this ``save()`` method. See :ref:`overriding-model-methods` for more details. @@ -533,7 +533,7 @@ value, the field will be added to the updated fields. Deleting objects ================ -.. method:: Model.delete([using=DEFAULT_DB_ALIAS, keep_parents=False]) +.. method:: Model.delete(using=DEFAULT_DB_ALIAS, keep_parents=False) Issues an SQL ``DELETE`` for the object. This only deletes the object in the database; the Python instance will still exist and will still have data in diff --git a/docs/ref/models/lookups.txt b/docs/ref/models/lookups.txt index 60dc505ed8..c2304209d7 100644 --- a/docs/ref/models/lookups.txt +++ b/docs/ref/models/lookups.txt @@ -198,7 +198,7 @@ Lookup reference The name of this lookup, used to identify it on parsing query expressions. It cannot contain the string ``"__"``. - .. method:: process_lhs(compiler, connection[, lhs=None]) + .. method:: process_lhs(compiler, connection, lhs=None) Returns a tuple ``(lhs_string, lhs_params)``, as returned by ``compiler.compile(lhs)``. This method can be overridden to tune how diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 039fea3dbc..3c0e9d0a61 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -128,7 +128,7 @@ QuerySet API Here's the formal declaration of a ``QuerySet``: -.. class:: QuerySet([model=None, query=None, using=None]) +.. class:: QuerySet(model=None, query=None, using=None) Usually when you'll interact with a ``QuerySet`` you'll use it by :ref:`chaining filters `. To make this work, most @@ -429,7 +429,7 @@ remain undefined afterward). distinct ~~~~~~~~ -.. method:: distinct([*fields]) +.. method:: distinct(*fields) Returns a new ``QuerySet`` that uses ``SELECT DISTINCT`` in its SQL query. This eliminates duplicate rows from the query results. diff --git a/docs/ref/models/relations.txt b/docs/ref/models/relations.txt index 8c3b5a2f33..095ee560c1 100644 --- a/docs/ref/models/relations.txt +++ b/docs/ref/models/relations.txt @@ -36,7 +36,7 @@ Related objects reference In this example, the methods below will be available both on ``topping.pizza_set`` and on ``pizza.toppings``. - .. method:: add(obj1, [obj2, ...]) + .. method:: add(*objs) Adds the specified model objects to the related object set. @@ -86,7 +86,7 @@ Related objects reference parameter ``blog`` to ``create()``. Django figures out that the new ``Entry`` object's ``blog`` field should be set to ``b``. - .. method:: remove(obj1, [obj2, ...]) + .. method:: remove(*objs) Removes the specified model objects from the related object set:: diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index ff80639940..3f84d0d144 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -539,7 +539,7 @@ In addition, ``QueryDict`` has the following methods: >>> q.dict() {'a': '5'} -.. method:: QueryDict.urlencode([safe]) +.. method:: QueryDict.urlencode(safe=None) Returns a string of the data in query-string format. Example:: diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt index 6847d832b9..9cd4fd791c 100644 --- a/docs/ref/templates/api.txt +++ b/docs/ref/templates/api.txt @@ -41,7 +41,7 @@ lower level APIs: Configuring an engine ===================== -.. class:: Engine([dirs][, app_dirs][, allowed_include_roots][, context_processors][, debug][, loaders][, string_if_invalid][, file_charset][, libraries][, builtins]) +.. class:: Engine(dirs=None, app_dirs=False, allowed_include_roots=None, context_processors=None, debug=False, loaders=None, string_if_invalid='', file_charset='utf-8', libraries=None, builtins=None) .. versionadded:: 1.8 @@ -202,7 +202,7 @@ Once you have a compiled :class:`Template` object, you can render a context with it. You can reuse the same template to render it several times with different contexts. -.. class:: Context([dict_][, current_app]) +.. class:: Context(dict_=None, current_app=_current_app_undefined) This class lives at ``django.template.Context``. The constructor takes two optional arguments: @@ -585,7 +585,7 @@ against ``dict``:: Subclassing Context: RequestContext ----------------------------------- -.. class:: RequestContext(request[, dict_][, processors]) +.. class:: RequestContext(request, dict_=None, processors=None) Django comes with a special ``Context`` class, ``django.template.RequestContext``, that acts slightly differently from the diff --git a/docs/ref/urlresolvers.txt b/docs/ref/urlresolvers.txt index 60a6192a90..aa0fe0d60d 100644 --- a/docs/ref/urlresolvers.txt +++ b/docs/ref/urlresolvers.txt @@ -10,7 +10,7 @@ reverse() If you need to use something similar to the :ttag:`url` template tag in your code, Django provides the following function: -.. function:: reverse(viewname, [urlconf=None, args=None, kwargs=None, current_app=None]) +.. function:: reverse(viewname, urlconf=None, args=None, kwargs=None, current_app=None) ``viewname`` can be a string containing the Python path to the view object, a :ref:`URL pattern name `, or the callable view object. @@ -97,7 +97,7 @@ reverse_lazy() A lazily evaluated version of `reverse()`_. -.. function:: reverse_lazy(viewname, [urlconf=None, args=None, kwargs=None, current_app=None]) +.. function:: reverse_lazy(viewname, urlconf=None, args=None, kwargs=None, current_app=None) It is useful for when you need to use a URL reversal before your project's URLConf is loaded. Some common cases where this function is necessary are: diff --git a/docs/ref/urls.txt b/docs/ref/urls.txt index dac6edc96d..1fb9375b79 100644 --- a/docs/ref/urls.txt +++ b/docs/ref/urls.txt @@ -128,9 +128,9 @@ parameter is useful. include() --------- -.. function:: include(module[, namespace=None, app_name=None]) +.. function:: include(module, namespace=None, app_name=None) include(pattern_list) - include((pattern_list, app_namespace)[, namespace=None]) + include((pattern_list, app_namespace), namespace=None) include((pattern_list, app_namespace, instance_namespace)) A function that takes a full Python import path to another URLconf module diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index d053dee8df..c9deba887a 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -334,7 +334,7 @@ SyndicationFeed Base class for all syndication feeds. Subclasses should provide write(). - .. method:: __init__(title, link, description, [language=None, author_email=None, author_name=None, author_link=None, subtitle=None, categories=None, feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs]) + .. method:: __init__(title, link, description, language=None, author_email=None, author_name=None, author_link=None, subtitle=None, categories=None, feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs) Initialize the feed with the given dictionary of metadata, which applies to the entire feed. @@ -345,7 +345,7 @@ SyndicationFeed All parameters should be Unicode objects, except ``categories``, which should be a sequence of Unicode objects. - .. method:: add_item(title, link, description, [author_email=None, author_name=None, author_link=None, pubdate=None, comments=None, unique_id=None, enclosure=None, categories=(), item_copyright=None, ttl=None, updateddate=None, **kwargs]) + .. method:: add_item(title, link, description, author_email=None, author_name=None, author_link=None, pubdate=None, comments=None, unique_id=None, enclosure=None, categories=(), item_copyright=None, ttl=None, updateddate=None, **kwargs) Adds an item to the feed. All args are expected to be Python ``unicode`` objects except ``pubdate`` and ``updateddate``, which are ``datetime.datetime`` diff --git a/docs/ref/validators.txt b/docs/ref/validators.txt index ebcbd081eb..6f10b44284 100644 --- a/docs/ref/validators.txt +++ b/docs/ref/validators.txt @@ -68,7 +68,7 @@ to, or in lieu of custom ``field.clean()`` methods. ``RegexValidator`` ------------------ -.. class:: RegexValidator([regex=None, message=None, code=None, inverse_match=None, flags=0]) +.. class:: RegexValidator(regex=None, message=None, code=None, inverse_match=None, flags=0) :param regex: If not ``None``, overrides :attr:`regex`. Can be a regular expression string or a pre-compiled regular expression. @@ -115,7 +115,7 @@ to, or in lieu of custom ``field.clean()`` methods. ``EmailValidator`` ------------------ -.. class:: EmailValidator([message=None, code=None, whitelist=None]) +.. class:: EmailValidator(message=None, code=None, whitelist=None) :param message: If not ``None``, overrides :attr:`.message`. :param code: If not ``None``, overrides :attr:`code`. @@ -144,7 +144,7 @@ to, or in lieu of custom ``field.clean()`` methods. ``URLValidator`` ---------------- -.. class:: URLValidator([schemes=None, regex=None, message=None, code=None]) +.. class:: URLValidator(schemes=None, regex=None, message=None, code=None) A :class:`RegexValidator` that ensures a value looks like a URL, and raises an error code of ``'invalid'`` if it doesn't. diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt index e388ec51ee..e85b2879b7 100644 --- a/docs/topics/auth/default.txt +++ b/docs/topics/auth/default.txt @@ -429,7 +429,7 @@ login page:: The ``login_required`` decorator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. function:: login_required([redirect_field_name=REDIRECT_FIELD_NAME, login_url=None]) +.. function:: login_required(redirect_field_name='next', login_url=None) As a shortcut, you can use the convenient :func:`~django.contrib.auth.decorators.login_required` decorator:: @@ -556,7 +556,7 @@ redirects to the login page:: return redirect('/login/?next=%s' % request.path) # ... -.. function:: user_passes_test(func, [login_url=None, redirect_field_name=REDIRECT_FIELD_NAME]) +.. function:: user_passes_test(func, login_url=None, redirect_field_name='next') As a shortcut, you can use the convenient ``user_passes_test`` decorator which performs a redirect when the callable returns ``False``:: @@ -643,7 +643,7 @@ redirects to the login page:: The ``permission_required`` decorator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. function:: permission_required(perm, [login_url=None, raise_exception=False]) +.. function:: permission_required(perm, login_url=None, raise_exception=False) It's a relatively common task to check whether a user has a particular permission. For that reason, Django provides a shortcut for that case: the @@ -923,7 +923,7 @@ All authentication views This is a list with all the views ``django.contrib.auth`` provides. For implementation details see :ref:`using-the-views`. -.. function:: login(request, [template_name, redirect_field_name, authentication_form, current_app, extra_context]) +.. function:: login(request, template_name=`registration/login.html`, redirect_field_name=, authentication_form, current_app, extra_context]) **URL name:** ``login`` @@ -1055,7 +1055,7 @@ implementation details see :ref:`using-the-views`. .. _forms documentation: ../forms/ .. _site framework docs: ../sites/ -.. function:: logout(request, [next_page, template_name, redirect_field_name, current_app, extra_context]) +.. function:: logout(request, next_page=None, template_name='registration/logged_out.html', redirect_field_name='next', current_app=None, extra_context=None) Logs a user out. @@ -1108,7 +1108,7 @@ implementation details see :ref:`using-the-views`. * ``extra_context``: A dictionary of context data that will be added to the default context data passed to the template. -.. function:: logout_then_login(request[, login_url, current_app, extra_context]) +.. function:: logout_then_login(request, login_url=None, current_app=None, extra_context=None) Logs a user out, then redirects to the login page. @@ -1131,7 +1131,7 @@ implementation details see :ref:`using-the-views`. The ``current_app`` parameter is deprecated and will be removed in Django 2.0. Callers should set ``request.current_app`` instead. -.. function:: password_change(request[, template_name, post_change_redirect, password_change_form, current_app, extra_context]) +.. function:: password_change(request, template_name='registration/password_change_form.html', post_change_redirect=None, password_change_form=PasswordChangeForm, current_app=None, extra_context=None) Allows a user to change their password. @@ -1167,7 +1167,7 @@ implementation details see :ref:`using-the-views`. * ``form``: The password change form (see ``password_change_form`` above). -.. function:: password_change_done(request[, template_name, current_app, extra_context]) +.. function:: password_change_done(request, template_name='registration/password_change_done.html', current_app=None, extra_context=None) The page shown after a user has changed their password. @@ -1191,7 +1191,7 @@ implementation details see :ref:`using-the-views`. The ``current_app`` parameter is deprecated and will be removed in Django 2.0. Callers should set ``request.current_app`` instead. -.. function:: password_reset(request[, is_admin_site, template_name, email_template_name, password_reset_form, token_generator, post_reset_redirect, from_email, current_app, extra_context, html_email_template_name]) +.. function:: password_reset(request, is_admin_site=False, template_name='registration/password_reset_form.html', email_template_name='registration/password_reset_email.html', password_reset_form='registration/password_reset_subject.txt', token_generator=default_token_generator, post_reset_redirect=None, from_email=None, current_app=None, extra_context=None, html_email_template_name=None) Allows a user to reset their password by generating a one-time use link that can be used to reset the password, and sending that link to the @@ -1300,7 +1300,7 @@ implementation details see :ref:`using-the-views`. The same template context is used for subject template. Subject must be single line plain text string. -.. function:: password_reset_done(request[, template_name, current_app, extra_context]) +.. function:: password_reset_done(request, template_name='registration/password_reset_done.html', current_app=None, extra_context=None) The page shown after a user has been emailed a link to reset their password. This view is called by default if the :func:`password_reset` view @@ -1332,7 +1332,7 @@ implementation details see :ref:`using-the-views`. The ``current_app`` parameter is deprecated and will be removed in Django 2.0. Callers should set ``request.current_app`` instead. -.. function:: password_reset_confirm(request[, uidb64, token, template_name, token_generator, set_password_form, post_reset_redirect, current_app, extra_context]) +.. function:: password_reset_confirm(request, uidb64=None, token=None, template_name='registration/password_reset_confirm.html', token_generator=default_token_generator, set_password_form=SetPasswordForm, post_reset_redirect=None, current_app=None, extra_context=None) Presents a form for entering a new password. @@ -1378,7 +1378,7 @@ implementation details see :ref:`using-the-views`. The ``current_app`` parameter is deprecated and will be removed in Django 2.0. Callers should set ``request.current_app`` instead. -.. function:: password_reset_complete(request[,template_name, current_app, extra_context]) +.. function:: password_reset_complete(request, template_name='registration/password_reset_complete.html', current_app=None, extra_context=None) Presents a view which informs the user that the password has been successfully changed. @@ -1407,7 +1407,7 @@ Helper functions .. currentmodule:: django.contrib.auth.views -.. function:: redirect_to_login(next[, login_url, redirect_field_name]) +.. function:: redirect_to_login(next, login_url=None, redirect_field_name='next') Redirects to the login page, and then back to another URL after a successful login. @@ -1500,7 +1500,7 @@ provides several built-in forms located in :mod:`django.contrib.auth.forms`: A form for generating and emailing a one-time use link to reset a user's password. - .. method:: send_email(subject_template_name, email_template_name, context, from_email, to_email, [html_email_template_name=None]) + .. method:: send_email(subject_template_name, email_template_name, context, from_email, to_email, html_email_template_name=None) .. versionadded:: 1.8 diff --git a/docs/topics/email.txt b/docs/topics/email.txt index 2b92e0b9fa..16db4976d6 100644 --- a/docs/topics/email.txt +++ b/docs/topics/email.txt @@ -447,7 +447,7 @@ can :ref:`write your own email backend `. SMTP backend ~~~~~~~~~~~~ -.. class:: backends.smtp.EmailBackend([host=None, port=None, username=None, password=None, use_tls=None, fail_silently=False, use_ssl=None, timeout=None, ssl_keyfile=None, ssl_certfile=None, **kwargs]) +.. class:: backends.smtp.EmailBackend(host=None, port=None, username=None, password=None, use_tls=None, fail_silently=False, use_ssl=None, timeout=None, ssl_keyfile=None, ssl_certfile=None, **kwargs) This is the default backend. Email will be sent through a SMTP server. diff --git a/docs/topics/http/shortcuts.txt b/docs/topics/http/shortcuts.txt index 17cac33707..ab8c237ee9 100644 --- a/docs/topics/http/shortcuts.txt +++ b/docs/topics/http/shortcuts.txt @@ -15,7 +15,7 @@ introduce controlled coupling for convenience's sake. ``render`` ========== -.. function:: render(request, template_name[, context][, context_instance][, content_type][, status][, current_app][, dirs][, using]) +.. function:: render(request, template_name, context=None, context_instance=_context_instance_undefined, content_type=None, status=None, current_app=_current_app_undefined, dirs=_dirs_undefined, using=None) Combines a given template with a given context dictionary and returns an :class:`~django.http.HttpResponse` object with that rendered text. @@ -117,7 +117,7 @@ This example is equivalent to:: ``render_to_response`` ====================== -.. function:: render_to_response(template_name[, context][, context_instance][, content_type][, status][, dirs][, using]) +.. function:: render_to_response(template_name, context=None, context_instance=_context_instance_undefined, content_type=None, status=None, dirs=_dirs_undefined, using=None) Renders a given template with a given context dictionary and returns an :class:`~django.http.HttpResponse` object with that rendered text. @@ -207,7 +207,7 @@ This example is equivalent to:: ``redirect`` ============ -.. function:: redirect(to[, permanent=False], *args, **kwargs) +.. function:: redirect(to, permanent=False, *args, **kwargs) Returns an :class:`~django.http.HttpResponseRedirect` to the appropriate URL for the arguments passed. diff --git a/docs/topics/signals.txt b/docs/topics/signals.txt index 0edc2a5964..fbc2409570 100644 --- a/docs/topics/signals.txt +++ b/docs/topics/signals.txt @@ -50,7 +50,7 @@ Listening to signals To receive a signal, you need to register a *receiver* function that gets called when the signal is sent by using the :meth:`Signal.connect` method: -.. method:: Signal.connect(receiver, [sender=None, weak=True, dispatch_uid=None]) +.. method:: Signal.connect(receiver, sender=None, weak=True, dispatch_uid=None) :param receiver: The callback function which will be connected to this signal. See :ref:`receiver-functions` for more information. @@ -208,7 +208,7 @@ its own signals. Defining signals ---------------- -.. class:: Signal([providing_args=list]) +.. class:: Signal(providing_args=list) All signals are :class:`django.dispatch.Signal` instances. The ``providing_args`` is a list of the names of arguments the signal will provide @@ -269,7 +269,7 @@ error instance is returned in the tuple pair for the receiver that raised the er Disconnecting signals ===================== -.. method:: Signal.disconnect([receiver=None, sender=None, dispatch_uid=None]) +.. method:: Signal.disconnect(receiver=None, sender=None, dispatch_uid=None) To disconnect a receiver from a signal, call :meth:`Signal.disconnect`. The arguments are as described in :meth:`.Signal.connect`. The method returns diff --git a/docs/topics/templates.txt b/docs/topics/templates.txt index 4e0e1db646..94ee9904a6 100644 --- a/docs/topics/templates.txt +++ b/docs/topics/templates.txt @@ -95,7 +95,7 @@ Usage The ``django.template.loader`` module defines two functions to load templates. -.. function:: get_template(template_name[, dirs][, using]) +.. function:: get_template(template_name, dirs=_dirs_undefined, using=None) This function loads the template with the given name and returns a ``Template`` object. @@ -128,7 +128,7 @@ The ``django.template.loader`` module defines two functions to load templates. ``get_template()`` returns a backend-dependent ``Template`` instead of a :class:`django.template.Template`. -.. function:: select_template(template_name_list[, dirs][, using]) +.. function:: select_template(template_name_list, dirs=_dirs_undefined, using=None) ``select_template()`` is just like ``get_template()``, except it takes a list of template names. It tries each name in order and returns the first @@ -269,7 +269,7 @@ the following templates: In addition, to cut down on the repetitive nature of loading and rendering templates, Django provides a shortcut function which automates the process. -.. function:: render_to_string(template_name[, context][, context_instance][, request][, using]) +.. function:: render_to_string(template_name, context=None, context_instance=_context_instance_undefined, request=None, using=None) ``render_to_string()`` loads a template like :func:`get_template` and calls its ``render()`` method immediately. It takes the following diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt index 93583893a9..7dab6aaf88 100644 --- a/docs/topics/testing/advanced.txt +++ b/docs/topics/testing/advanced.txt @@ -570,7 +570,7 @@ django.db.connection.creation The creation module of the database backend also provides some utilities that can be useful during testing. -.. function:: create_test_db([verbosity=1, autoclobber=False, serialize=True, keepdb=False]) +.. function:: create_test_db(verbosity=1, autoclobber=False, serialize=True, keepdb=False) Creates a new test database and runs ``migrate`` against it. @@ -612,7 +612,7 @@ can be useful during testing. The ``keepdb`` argument was added. -.. function:: destroy_test_db(old_database_name, [verbosity=1, keepdb=False]) +.. function:: destroy_test_db(old_database_name, verbosity=1, keepdb=False) Destroys the database whose name is the value of :setting:`NAME` in :setting:`DATABASES`, and sets :setting:`NAME` to the value of