Don't show `self` in the list of arguments of a method.

This is consistent with Python's official documentation
and it's a sphinx recommendation too[1].

[1] http://sphinx-doc.org/markup/desc.html#dir-method

Refs #21855.
This commit is contained in:
Baptiste Mispelon 2014-01-22 22:17:32 +01:00
parent 5f9790072d
commit 79e1d6ebd7
11 changed files with 71 additions and 71 deletions

View File

@ -421,7 +421,7 @@ approximately decreasing order of importance, so start from the top.
Custom database types Custom database types
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
.. method:: Field.db_type(self, connection) .. method:: Field.db_type(connection)
Returns the database column data type for the :class:`~django.db.models.Field`, Returns the database column data type for the :class:`~django.db.models.Field`,
taking into account the connection object, and the settings associated with it. taking into account the connection object, and the settings associated with it.
@ -510,7 +510,7 @@ get out of the way.
Converting database values to Python objects Converting database values to Python objects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. method:: Field.to_python(self, value) .. method:: Field.to_python(value)
Converts a value as returned by your database (or a serializer) to a Python Converts a value as returned by your database (or a serializer) to a Python
object. object.
@ -571,7 +571,7 @@ automatically.
Converting Python objects to query values Converting Python objects to query values
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. method:: Field.get_prep_value(self, value) .. method:: Field.get_prep_value(value)
This is the reverse of :meth:`.to_python` when working with the This is the reverse of :meth:`.to_python` when working with the
database backends (as opposed to serialization). The ``value`` database backends (as opposed to serialization). The ``value``
@ -596,7 +596,7 @@ For example::
Converting query values to database values Converting query values to database values
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. method:: Field.get_db_prep_value(self, value, connection, prepared=False) .. method:: Field.get_db_prep_value(value, connection, prepared=False)
Some data types (for example, dates) need to be in a specific format Some data types (for example, dates) need to be in a specific format
before they can be used by a database backend. before they can be used by a database backend.
@ -612,7 +612,7 @@ already been passed through :meth:`.get_prep_value` conversions. When
initial data conversions before performing any database-specific initial data conversions before performing any database-specific
processing. processing.
.. method:: Field.get_db_prep_save(self, value, connection) .. method:: Field.get_db_prep_save(value, connection)
Same as the above, but called when the Field value must be *saved* to Same as the above, but called when the Field value must be *saved* to
the database. As the default implementation just calls the database. As the default implementation just calls
@ -624,7 +624,7 @@ parameters (which is implemented by :meth:`.get_db_prep_value`).
Preprocessing values before saving Preprocessing values before saving
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. method:: Field.pre_save(self, model_instance, add) .. method:: Field.pre_save(model_instance, add)
This method is called just prior to :meth:`.get_db_prep_save` and should return This method is called just prior to :meth:`.get_db_prep_save` and should return
the value of the appropriate attribute from ``model_instance`` for this field. the value of the appropriate attribute from ``model_instance`` for this field.
@ -650,7 +650,7 @@ Preparing values for use in database lookups
As with value conversions, preparing a value for database lookups is a As with value conversions, preparing a value for database lookups is a
two phase process. two phase process.
.. method:: Field.get_prep_lookup(self, lookup_type, value) .. method:: Field.get_prep_lookup(lookup_type, value)
:meth:`.get_prep_lookup` performs the first phase of lookup preparation, :meth:`.get_prep_lookup` performs the first phase of lookup preparation,
performing generic data validity checks performing generic data validity checks
@ -704,7 +704,7 @@ accepted lookup types to ``exact`` and ``in``::
else: else:
raise TypeError('Lookup type %r not supported.' % lookup_type) raise TypeError('Lookup type %r not supported.' % lookup_type)
.. method:: Field.get_db_prep_lookup(self, lookup_type, value, connection, prepared=False) .. method:: Field.get_db_prep_lookup(lookup_type, value, connection, prepared=False)
Performs any database-specific data conversions required by a lookup. Performs any database-specific data conversions required by a lookup.
As with :meth:`.get_db_prep_value`, the specific connection that will As with :meth:`.get_db_prep_value`, the specific connection that will
@ -715,7 +715,7 @@ prepared with :meth:`.get_prep_lookup`.
Specifying the form field for a model field Specifying the form field for a model field
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. method:: Field.formfield(self, form_class=None, choices_form_class=None, **kwargs) .. method:: Field.formfield(form_class=None, choices_form_class=None, **kwargs)
Returns the default form field to use when this model field is displayed in a Returns the default form field to use when this model field is displayed in a
form. This method is called by the :class:`~django.forms.ModelForm` helper. form. This method is called by the :class:`~django.forms.ModelForm` helper.
@ -755,7 +755,7 @@ fields.
Emulating built-in field types Emulating built-in field types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. method:: Field.get_internal_type(self) .. method:: Field.get_internal_type()
Returns a string giving the name of the :class:`~django.db.models.Field` Returns a string giving the name of the :class:`~django.db.models.Field`
subclass we are emulating at the database level. This is used to determine the subclass we are emulating at the database level. This is used to determine the
@ -790,7 +790,7 @@ output in some other place, outside of Django.
Converting field data for serialization Converting field data for serialization
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. method:: Field.value_to_string(self, obj) .. method:: Field.value_to_string(obj)
This method is used by the serializers to convert the field into a string for This method is used by the serializers to convert the field into a string for
output. Calling ``Field._get_val_from_obj(obj)`` is the best way to get the output. Calling ``Field._get_val_from_obj(obj)`` is the best way to get the

View File

@ -250,24 +250,24 @@ following methods:
.. class:: SafeExceptionReporterFilter .. class:: SafeExceptionReporterFilter
.. method:: SafeExceptionReporterFilter.is_active(self, request) .. method:: SafeExceptionReporterFilter.is_active(request)
Returns ``True`` to activate the filtering operated in the other methods. Returns ``True`` to activate the filtering operated in the other methods.
By default the filter is active if :setting:`DEBUG` is ``False``. By default the filter is active if :setting:`DEBUG` is ``False``.
.. method:: SafeExceptionReporterFilter.get_request_repr(self, request) .. method:: SafeExceptionReporterFilter.get_request_repr(request)
Returns the representation string of the request object, that is, the Returns the representation string of the request object, that is, the
value that would be returned by ``repr(request)``, except it uses the value that would be returned by ``repr(request)``, except it uses the
filtered dictionary of POST parameters as determined by filtered dictionary of POST parameters as determined by
:meth:`SafeExceptionReporterFilter.get_post_parameters`. :meth:`SafeExceptionReporterFilter.get_post_parameters`.
.. method:: SafeExceptionReporterFilter.get_post_parameters(self, request) .. method:: SafeExceptionReporterFilter.get_post_parameters(request)
Returns the filtered dictionary of POST parameters. By default it replaces Returns the filtered dictionary of POST parameters. By default it replaces
the values of sensitive parameters with stars (`**********`). the values of sensitive parameters with stars (`**********`).
.. method:: SafeExceptionReporterFilter.get_traceback_frame_variables(self, request, tb_frame) .. method:: SafeExceptionReporterFilter.get_traceback_frame_variables(request, tb_frame)
Returns the filtered dictionary of local variables for the given traceback Returns the filtered dictionary of local variables for the given traceback
frame. By default it replaces the values of sensitive variables with stars frame. By default it replaces the values of sensitive variables with stars

View File

@ -1202,7 +1202,7 @@ templates used by the :class:`ModelAdmin` views:
save/delete the object, they are not for veto purposes, rather they allow save/delete the object, they are not for veto purposes, rather they allow
you to perform extra operations. you to perform extra operations.
.. method:: ModelAdmin.save_model(self, request, obj, form, change) .. method:: ModelAdmin.save_model(request, obj, form, change)
The ``save_model`` method is given the ``HttpRequest``, a model instance, The ``save_model`` method is given the ``HttpRequest``, a model instance,
a ``ModelForm`` instance and a boolean value based on whether it is adding a ``ModelForm`` instance and a boolean value based on whether it is adding
@ -1217,12 +1217,12 @@ templates used by the :class:`ModelAdmin` views:
obj.user = request.user obj.user = request.user
obj.save() obj.save()
.. method:: ModelAdmin.delete_model(self, request, obj) .. method:: ModelAdmin.delete_model(request, obj)
The ``delete_model`` method is given the ``HttpRequest`` and a model The ``delete_model`` method is given the ``HttpRequest`` and a model
instance. Use this method to do pre- or post-delete operations. instance. Use this method to do pre- or post-delete operations.
.. method:: ModelAdmin.save_formset(self, request, form, formset, change) .. method:: ModelAdmin.save_formset(request, form, formset, change)
The ``save_formset`` method is given the ``HttpRequest``, the parent The ``save_formset`` method is given the ``HttpRequest``, the parent
``ModelForm`` instance and a boolean value based on whether it is adding or ``ModelForm`` instance and a boolean value based on whether it is adding or
@ -1239,7 +1239,7 @@ templates used by the :class:`ModelAdmin` views:
instance.save() instance.save()
formset.save_m2m() formset.save_m2m()
.. method:: ModelAdmin.get_ordering(self, request) .. method:: ModelAdmin.get_ordering(request)
The ``get_ordering`` method takes a``request`` as parameter and The ``get_ordering`` method takes a``request`` as parameter and
is expected to return a ``list`` or ``tuple`` for ordering similar is expected to return a ``list`` or ``tuple`` for ordering similar
@ -1253,7 +1253,7 @@ templates used by the :class:`ModelAdmin` views:
else: else:
return ['name'] return ['name']
.. method:: ModelAdmin.get_search_results(self, request, queryset, search_term) .. method:: ModelAdmin.get_search_results(request, queryset, search_term)
.. versionadded:: 1.6 .. versionadded:: 1.6
@ -1286,7 +1286,7 @@ templates used by the :class:`ModelAdmin` views:
pass pass
return queryset, use_distinct return queryset, use_distinct
.. method:: ModelAdmin.save_related(self, request, form, formsets, change) .. method:: ModelAdmin.save_related(request, form, formsets, change)
The ``save_related`` method is given the ``HttpRequest``, the parent The ``save_related`` method is given the ``HttpRequest``, the parent
``ModelForm`` instance, the list of inline formsets and a boolean value ``ModelForm`` instance, the list of inline formsets and a boolean value
@ -1294,28 +1294,28 @@ templates used by the :class:`ModelAdmin` views:
pre- or post-save operations for objects related to the parent. Note pre- or post-save operations for objects related to the parent. Note
that at this point the parent object and its form have already been saved. that at this point the parent object and its form have already been saved.
.. method:: ModelAdmin.get_readonly_fields(self, request, obj=None) .. method:: ModelAdmin.get_readonly_fields(request, obj=None)
The ``get_readonly_fields`` method is given the ``HttpRequest`` and the The ``get_readonly_fields`` method is given the ``HttpRequest`` and the
``obj`` being edited (or ``None`` on an add form) and is expected to return ``obj`` being edited (or ``None`` on an add form) and is expected to return
a ``list`` or ``tuple`` of field names that will be displayed as read-only, a ``list`` or ``tuple`` of field names that will be displayed as read-only,
as described above in the :attr:`ModelAdmin.readonly_fields` section. as described above in the :attr:`ModelAdmin.readonly_fields` section.
.. method:: ModelAdmin.get_prepopulated_fields(self, request, obj=None) .. method:: ModelAdmin.get_prepopulated_fields(request, obj=None)
The ``get_prepopulated_fields`` method is given the ``HttpRequest`` and the The ``get_prepopulated_fields`` method is given the ``HttpRequest`` and the
``obj`` being edited (or ``None`` on an add form) and is expected to return ``obj`` being edited (or ``None`` on an add form) and is expected to return
a ``dictionary``, as described above in the :attr:`ModelAdmin.prepopulated_fields` a ``dictionary``, as described above in the :attr:`ModelAdmin.prepopulated_fields`
section. section.
.. method:: ModelAdmin.get_list_display(self, request) .. method:: ModelAdmin.get_list_display(request)
The ``get_list_display`` method is given the ``HttpRequest`` and is The ``get_list_display`` method is given the ``HttpRequest`` and is
expected to return a ``list`` or ``tuple`` of field names that will be expected to return a ``list`` or ``tuple`` of field names that will be
displayed on the changelist view as described above in the displayed on the changelist view as described above in the
:attr:`ModelAdmin.list_display` section. :attr:`ModelAdmin.list_display` section.
.. method:: ModelAdmin.get_list_display_links(self, request, list_display) .. method:: ModelAdmin.get_list_display_links(request, list_display)
The ``get_list_display_links`` method is given the ``HttpRequest`` and The ``get_list_display_links`` method is given the ``HttpRequest`` and
the ``list`` or ``tuple`` returned by :meth:`ModelAdmin.get_list_display`. the ``list`` or ``tuple`` returned by :meth:`ModelAdmin.get_list_display`.
@ -1327,7 +1327,7 @@ templates used by the :class:`ModelAdmin` views:
``None`` was added as a valid ``get_list_display_links()`` return value. ``None`` was added as a valid ``get_list_display_links()`` return value.
.. method:: ModelAdmin.get_fields(self, request, obj=None) .. method:: ModelAdmin.get_fields(request, obj=None)
.. versionadded:: 1.7 .. versionadded:: 1.7
@ -1335,20 +1335,20 @@ templates used by the :class:`ModelAdmin` views:
being edited (or ``None`` on an add form) and is expected to return a list being edited (or ``None`` on an add form) and is expected to return a list
of fields, as described above in the :attr:`ModelAdmin.fields` section. of fields, as described above in the :attr:`ModelAdmin.fields` section.
.. method:: ModelAdmin.get_fieldsets(self, request, obj=None) .. method:: ModelAdmin.get_fieldsets(request, obj=None)
The ``get_fieldsets`` method is given the ``HttpRequest`` and the ``obj`` The ``get_fieldsets`` method is given the ``HttpRequest`` and the ``obj``
being edited (or ``None`` on an add form) and is expected to return a list being edited (or ``None`` on an add form) and is expected to return a list
of two-tuples, in which each two-tuple represents a ``<fieldset>`` on the of two-tuples, in which each two-tuple represents a ``<fieldset>`` on the
admin form page, as described above in the :attr:`ModelAdmin.fieldsets` section. admin form page, as described above in the :attr:`ModelAdmin.fieldsets` section.
.. method:: ModelAdmin.get_list_filter(self, request) .. method:: ModelAdmin.get_list_filter(request)
The ``get_list_filter`` method is given the ``HttpRequest`` and is expected The ``get_list_filter`` method is given the ``HttpRequest`` and is expected
to return the same kind of sequence type as for the to return the same kind of sequence type as for the
:attr:`~ModelAdmin.list_filter` attribute. :attr:`~ModelAdmin.list_filter` attribute.
.. method:: ModelAdmin.get_search_fields(self, request) .. method:: ModelAdmin.get_search_fields(request)
.. versionadded:: 1.7 .. versionadded:: 1.7
@ -1356,7 +1356,7 @@ templates used by the :class:`ModelAdmin` views:
to return the same kind of sequence type as for the to return the same kind of sequence type as for the
:attr:`~ModelAdmin.search_fields` attribute. :attr:`~ModelAdmin.search_fields` attribute.
.. method:: ModelAdmin.get_inline_instances(self, request, obj=None) .. method:: ModelAdmin.get_inline_instances(request, obj=None)
The ``get_inline_instances`` method is given the ``HttpRequest`` and the The ``get_inline_instances`` method is given the ``HttpRequest`` and the
``obj`` being edited (or ``None`` on an add form) and is expected to return ``obj`` being edited (or ``None`` on an add form) and is expected to return
@ -1364,7 +1364,7 @@ templates used by the :class:`ModelAdmin` views:
objects, as described below in the :class:`~django.contrib.admin.InlineModelAdmin` objects, as described below in the :class:`~django.contrib.admin.InlineModelAdmin`
section. section.
.. method:: ModelAdmin.get_urls(self) .. method:: ModelAdmin.get_urls()
The ``get_urls`` method on a ``ModelAdmin`` returns the URLs to be used for The ``get_urls`` method on a ``ModelAdmin`` returns the URLs to be used for
that ModelAdmin in the same way as a URLconf. Therefore you can extend that ModelAdmin in the same way as a URLconf. Therefore you can extend
@ -1429,7 +1429,7 @@ templates used by the :class:`ModelAdmin` views:
(r'^my_view/$', self.admin_site.admin_view(self.my_view, cacheable=True)) (r'^my_view/$', self.admin_site.admin_view(self.my_view, cacheable=True))
.. method:: ModelAdmin.get_form(self, request, obj=None, **kwargs) .. method:: ModelAdmin.get_form(request, obj=None, **kwargs)
Returns a :class:`~django.forms.ModelForm` class for use in the admin add Returns a :class:`~django.forms.ModelForm` class for use in the admin add
and change views, see :meth:`add_view` and :meth:`change_view`. and change views, see :meth:`add_view` and :meth:`change_view`.
@ -1444,7 +1444,7 @@ templates used by the :class:`ModelAdmin` views:
self.exclude.append('field_to_hide') self.exclude.append('field_to_hide')
return super(MyModelAdmin, self).get_form(request, obj, **kwargs) return super(MyModelAdmin, self).get_form(request, obj, **kwargs)
.. method:: ModelAdmin.get_formsets(self, request, obj=None) .. method:: ModelAdmin.get_formsets(request, obj=None)
.. deprecated:: 1.7 .. deprecated:: 1.7
Use :meth:`get_formsets_with_inlines()` instead. Use :meth:`get_formsets_with_inlines()` instead.
@ -1464,7 +1464,7 @@ templates used by the :class:`ModelAdmin` views:
continue continue
yield inline.get_formset(request, obj) yield inline.get_formset(request, obj)
.. method:: ModelAdmin.get_formsets_with_inlines(self, request, obj=None) .. method:: ModelAdmin.get_formsets_with_inlines(request, obj=None)
Yields (``FormSet``, :class:`InlineModelAdmin`) pairs for use in admin add Yields (``FormSet``, :class:`InlineModelAdmin`) pairs for use in admin add
and change views. and change views.
@ -1482,7 +1482,7 @@ templates used by the :class:`ModelAdmin` views:
continue continue
yield inline.get_formset(request, obj), inline yield inline.get_formset(request, obj), inline
.. method:: ModelAdmin.formfield_for_foreignkey(self, db_field, request, **kwargs) .. method:: ModelAdmin.formfield_for_foreignkey(db_field, request, **kwargs)
The ``formfield_for_foreignkey`` method on a ``ModelAdmin`` allows you to The ``formfield_for_foreignkey`` method on a ``ModelAdmin`` allows you to
override the default formfield for a foreign keys field. For example, to override the default formfield for a foreign keys field. For example, to
@ -1497,7 +1497,7 @@ templates used by the :class:`ModelAdmin` views:
This uses the ``HttpRequest`` instance to filter the ``Car`` foreign key This uses the ``HttpRequest`` instance to filter the ``Car`` foreign key
field to only display the cars owned by the ``User`` instance. field to only display the cars owned by the ``User`` instance.
.. method:: ModelAdmin.formfield_for_manytomany(self, db_field, request, **kwargs) .. method:: ModelAdmin.formfield_for_manytomany(db_field, request, **kwargs)
Like the ``formfield_for_foreignkey`` method, the Like the ``formfield_for_foreignkey`` method, the
``formfield_for_manytomany`` method can be overridden to change the ``formfield_for_manytomany`` method can be overridden to change the
@ -1512,7 +1512,7 @@ templates used by the :class:`ModelAdmin` views:
kwargs["queryset"] = Car.objects.filter(owner=request.user) kwargs["queryset"] = Car.objects.filter(owner=request.user)
return super(MyModelAdmin, self).formfield_for_manytomany(db_field, request, **kwargs) return super(MyModelAdmin, self).formfield_for_manytomany(db_field, request, **kwargs)
.. method:: ModelAdmin.formfield_for_choice_field(self, db_field, request, **kwargs) .. method:: ModelAdmin.formfield_for_choice_field(db_field, request, **kwargs)
Like the ``formfield_for_foreignkey`` and ``formfield_for_manytomany`` Like the ``formfield_for_foreignkey`` and ``formfield_for_manytomany``
methods, the ``formfield_for_choice_field`` method can be overridden to methods, the ``formfield_for_choice_field`` method can be overridden to
@ -1540,13 +1540,13 @@ templates used by the :class:`ModelAdmin` views:
a :exc:`~django.core.exceptions.ValidationError` when the model itself a :exc:`~django.core.exceptions.ValidationError` when the model itself
is validated before saving. is validated before saving.
.. method:: ModelAdmin.get_changelist(self, request, **kwargs) .. method:: ModelAdmin.get_changelist(request, **kwargs)
Returns the ``Changelist`` class to be used for listing. By default, Returns the ``Changelist`` class to be used for listing. By default,
``django.contrib.admin.views.main.ChangeList`` is used. By inheriting this ``django.contrib.admin.views.main.ChangeList`` is used. By inheriting this
class you can change the behavior of the listing. class you can change the behavior of the listing.
.. method:: ModelAdmin.get_changelist_form(self, request, **kwargs) .. method:: ModelAdmin.get_changelist_form(request, **kwargs)
Returns a :class:`~django.forms.ModelForm` class for use in the ``Formset`` Returns a :class:`~django.forms.ModelForm` class for use in the ``Formset``
on the changelist page. To use a custom form, for example:: on the changelist page. To use a custom form, for example::
@ -1572,7 +1572,7 @@ templates used by the :class:`ModelAdmin` views:
omit the ``Meta.model`` attribute, since ``ModelAdmin`` will provide the omit the ``Meta.model`` attribute, since ``ModelAdmin`` will provide the
correct model to use. correct model to use.
.. method:: ModelAdmin.get_changelist_formset(self, request, **kwargs) .. method:: ModelAdmin.get_changelist_formset(request, **kwargs)
Returns a :ref:`ModelFormSet <model-formsets>` class for use on the Returns a :ref:`ModelFormSet <model-formsets>` class for use on the
changelist page if :attr:`~ModelAdmin.list_editable` is used. To use a changelist page if :attr:`~ModelAdmin.list_editable` is used. To use a
@ -1588,12 +1588,12 @@ templates used by the :class:`ModelAdmin` views:
kwargs['formset'] = MyAdminFormSet kwargs['formset'] = MyAdminFormSet
return super(MyModelAdmin, self).get_changelist_formset(request, **kwargs) return super(MyModelAdmin, self).get_changelist_formset(request, **kwargs)
.. method:: ModelAdmin.has_add_permission(self, request) .. method:: ModelAdmin.has_add_permission(request)
Should return ``True`` if adding an object is permitted, ``False`` Should return ``True`` if adding an object is permitted, ``False``
otherwise. otherwise.
.. method:: ModelAdmin.has_change_permission(self, request, obj=None) .. method:: ModelAdmin.has_change_permission(request, obj=None)
Should return ``True`` if editing obj is permitted, ``False`` otherwise. Should return ``True`` if editing obj is permitted, ``False`` otherwise.
If obj is ``None``, should return ``True`` or ``False`` to indicate whether If obj is ``None``, should return ``True`` or ``False`` to indicate whether
@ -1601,7 +1601,7 @@ templates used by the :class:`ModelAdmin` views:
will be interpreted as meaning that the current user is not permitted to will be interpreted as meaning that the current user is not permitted to
edit any object of this type). edit any object of this type).
.. method:: ModelAdmin.has_delete_permission(self, request, obj=None) .. method:: ModelAdmin.has_delete_permission(request, obj=None)
Should return ``True`` if deleting obj is permitted, ``False`` otherwise. Should return ``True`` if deleting obj is permitted, ``False`` otherwise.
If obj is ``None``, should return ``True`` or ``False`` to indicate whether If obj is ``None``, should return ``True`` or ``False`` to indicate whether
@ -1609,7 +1609,7 @@ templates used by the :class:`ModelAdmin` views:
be interpreted as meaning that the current user is not permitted to delete be interpreted as meaning that the current user is not permitted to delete
any object of this type). any object of this type).
.. method:: ModelAdmin.get_queryset(self, request) .. method:: ModelAdmin.get_queryset(request)
The ``get_queryset`` method on a ``ModelAdmin`` returns a The ``get_queryset`` method on a ``ModelAdmin`` returns a
:class:`~django.db.models.query.QuerySet` of all model instances that :class:`~django.db.models.query.QuerySet` of all model instances that
@ -1644,7 +1644,7 @@ templates used by the :class:`ModelAdmin` views:
Returns an instance of the paginator to use for this view. By default, Returns an instance of the paginator to use for this view. By default,
instantiates an instance of :attr:`paginator`. instantiates an instance of :attr:`paginator`.
.. method:: ModelAdmin.response_add(self, request, obj, post_url_continue=None) .. method:: ModelAdmin.response_add(request, obj, post_url_continue=None)
Determines the :class:`~django.http.HttpResponse` for the Determines the :class:`~django.http.HttpResponse` for the
:meth:`add_view` stage. :meth:`add_view` stage.
@ -1654,7 +1654,7 @@ templates used by the :class:`ModelAdmin` views:
been created and saved. You can override it to change the default behavior been created and saved. You can override it to change the default behavior
after the object has been created. after the object has been created.
.. method:: ModelAdmin.response_change(self, request, obj) .. method:: ModelAdmin.response_change(request, obj)
Determines the :class:`~django.http.HttpResponse` for the Determines the :class:`~django.http.HttpResponse` for the
:meth:`change_view` stage. :meth:`change_view` stage.
@ -1664,7 +1664,7 @@ templates used by the :class:`ModelAdmin` views:
been saved. You can override it to change the default been saved. You can override it to change the default
behavior after the object has been changedn. behavior after the object has been changedn.
.. method:: ModelAdmin.response_delete(self, request, obj_display) .. method:: ModelAdmin.response_delete(request, obj_display)
.. versionadded:: 1.7 .. versionadded:: 1.7
@ -1681,25 +1681,25 @@ templates used by the :class:`ModelAdmin` views:
Other methods Other methods
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
.. method:: ModelAdmin.add_view(self, request, form_url='', extra_context=None) .. method:: ModelAdmin.add_view(request, form_url='', extra_context=None)
Django view for the model instance addition page. See note below. Django view for the model instance addition page. See note below.
.. method:: ModelAdmin.change_view(self, request, object_id, form_url='', extra_context=None) .. method:: ModelAdmin.change_view(request, object_id, form_url='', extra_context=None)
Django view for the model instance edition page. See note below. Django view for the model instance edition page. See note below.
.. method:: ModelAdmin.changelist_view(self, request, extra_context=None) .. method:: ModelAdmin.changelist_view(request, extra_context=None)
Django view for the model instances change list/actions page. See note Django view for the model instances change list/actions page. See note
below. below.
.. method:: ModelAdmin.delete_view(self, request, object_id, extra_context=None) .. method:: ModelAdmin.delete_view(request, object_id, extra_context=None)
Django view for the model instance(s) deletion confirmation page. See note Django view for the model instance(s) deletion confirmation page. See note
below. below.
.. method:: ModelAdmin.history_view(self, request, object_id, extra_context=None) .. method:: ModelAdmin.history_view(request, object_id, extra_context=None)
Django view for the page that shows the modification history for a given Django view for the page that shows the modification history for a given
model instance. model instance.
@ -1976,13 +1976,13 @@ The ``InlineModelAdmin`` class adds:
Specifies whether or not inline objects can be deleted in the inline. Specifies whether or not inline objects can be deleted in the inline.
Defaults to ``True``. Defaults to ``True``.
.. method:: InlineModelAdmin.get_formset(self, request, obj=None, **kwargs) .. method:: InlineModelAdmin.get_formset(request, obj=None, **kwargs)
Returns a :class:`~django.forms.models.BaseInlineFormSet` class for use in Returns a :class:`~django.forms.models.BaseInlineFormSet` class for use in
admin add/change views. See the example for admin add/change views. See the example for
:class:`ModelAdmin.get_formsets`. :class:`ModelAdmin.get_formsets`.
.. method:: InlineModelAdmin.get_extra(self, request, obj=None, **kwargs) .. method:: InlineModelAdmin.get_extra(request, obj=None, **kwargs)
.. versionadded:: 1.6 .. versionadded:: 1.6
@ -2002,7 +2002,7 @@ The ``InlineModelAdmin`` class adds:
return extra - obj.binarytree_set.count() return extra - obj.binarytree_set.count()
return extra return extra
.. method:: InlineModelAdmin.get_max_num(self, request, obj=None, **kwargs) .. method:: InlineModelAdmin.get_max_num(request, obj=None, **kwargs)
.. versionadded:: 1.6 .. versionadded:: 1.6

View File

@ -260,7 +260,7 @@ Manager methods
See :ref:`Creating users <topics-auth-creating-users>` for example usage. See :ref:`Creating users <topics-auth-creating-users>` for example usage.
.. method:: create_superuser(self, username, email, password, **extra_fields) .. method:: create_superuser(username, email, password, **extra_fields)
Same as :meth:`create_user`, but sets :attr:`~models.User.is_staff` and Same as :meth:`create_user`, but sets :attr:`~models.User.is_staff` and
:attr:`~models.User.is_superuser` to ``True``. :attr:`~models.User.is_superuser` to ``True``.

View File

@ -873,7 +873,7 @@ systems and coordinate transformation::
A string representing this envelope as a polygon in WKT format. A string representing this envelope as a polygon in WKT format.
.. method:: expand_to_include(self, *args) .. method:: expand_to_include(*args)
Coordinate System Objects Coordinate System Objects
========================= =========================

View File

@ -137,7 +137,7 @@ into those elements.
See `a complex example`_ below that uses a description template. See `a complex example`_ below that uses a description template.
.. method:: Feed.get_context_data(self, **kwargs) .. method:: Feed.get_context_data(**kwargs)
.. versionadded:: 1.6 .. versionadded:: 1.6

View File

@ -216,7 +216,7 @@ foundation for custom widgets.
The 'value' given is not guaranteed to be valid input, therefore The 'value' given is not guaranteed to be valid input, therefore
subclass implementations should program defensively. subclass implementations should program defensively.
.. method:: value_from_datadict(self, data, files, name) .. method:: value_from_datadict(data, files, name)
Given a dictionary of data and this widget's name, returns the value Given a dictionary of data and this widget's name, returns the value
of this widget. Returns ``None`` if a value wasn't provided. of this widget. Returns ``None`` if a value wasn't provided.

View File

@ -167,7 +167,7 @@ As we can see, ``formset.errors`` is a list whose entries correspond to the
forms in the formset. Validation was performed for each of the two forms, and forms in the formset. Validation was performed for each of the two forms, and
the expected error message appears for the second item. the expected error message appears for the second item.
.. method:: BaseFormSet.total_error_count(self) .. method:: BaseFormSet.total_error_count()
.. versionadded:: 1.6 .. versionadded:: 1.6

View File

@ -386,7 +386,7 @@ Required methods
Custom file upload handlers **must** define the following methods: Custom file upload handlers **must** define the following methods:
.. method:: FileUploadHandler.receive_data_chunk(self, raw_data, start) .. method:: FileUploadHandler.receive_data_chunk(raw_data, start)
Receives a "chunk" of data from the file upload. Receives a "chunk" of data from the file upload.
@ -407,7 +407,7 @@ Custom file upload handlers **must** define the following methods:
If you raise a ``StopUpload`` or a ``SkipFile`` exception, the upload If you raise a ``StopUpload`` or a ``SkipFile`` exception, the upload
will abort or the file will be completely skipped. will abort or the file will be completely skipped.
.. method:: FileUploadHandler.file_complete(self, file_size) .. method:: FileUploadHandler.file_complete(file_size)
Called when a file has finished uploading. Called when a file has finished uploading.
@ -434,7 +434,7 @@ attributes:
The default is 64*2\ :sup:`10` bytes, or 64 KB. The default is 64*2\ :sup:`10` bytes, or 64 KB.
.. method:: FileUploadHandler.new_file(self, field_name, file_name, content_type, content_length, charset, content_type_extra) .. method:: FileUploadHandler.new_file(field_name, file_name, content_type, content_length, charset, content_type_extra)
Callback signaling that a new file upload is starting. This is called Callback signaling that a new file upload is starting. This is called
before any data has been fed to any upload handlers. before any data has been fed to any upload handlers.
@ -463,11 +463,11 @@ attributes:
The ``content_type_extra`` parameter was added. The ``content_type_extra`` parameter was added.
.. method:: FileUploadHandler.upload_complete(self) .. method:: FileUploadHandler.upload_complete()
Callback signaling that the entire upload (all files) has completed. Callback signaling that the entire upload (all files) has completed.
.. method:: FileUploadHandler.handle_raw_input(self, input_data, META, content_length, boundary, encoding) .. method:: FileUploadHandler.handle_raw_input(input_data, META, content_length, boundary, encoding)
Allows the handler to completely override the parsing of the raw Allows the handler to completely override the parsing of the raw
HTTP input. HTTP input.

View File

@ -85,7 +85,7 @@ Python class that defines one or more of the following methods:
``process_request`` ``process_request``
------------------- -------------------
.. method:: process_request(self, request) .. method:: process_request(request)
``request`` is an :class:`~django.http.HttpRequest` object. ``request`` is an :class:`~django.http.HttpRequest` object.
@ -106,7 +106,7 @@ return the result.
``process_view`` ``process_view``
---------------- ----------------
.. method:: process_view(self, request, view_func, view_args, view_kwargs) .. method:: process_view(request, view_func, view_args, view_kwargs)
``request`` is an :class:`~django.http.HttpRequest` object. ``view_func`` is ``request`` is an :class:`~django.http.HttpRequest` object. ``view_func`` is
the Python function that Django is about to use. (It's the actual function the Python function that Django is about to use. (It's the actual function
@ -146,7 +146,7 @@ view; it'll apply response middleware to that
``process_template_response`` ``process_template_response``
----------------------------- -----------------------------
.. method:: process_template_response(self, request, response) .. method:: process_template_response(request, response)
``request`` is an :class:`~django.http.HttpRequest` object. ``response`` is ``request`` is an :class:`~django.http.HttpRequest` object. ``response`` is
the :class:`~django.template.response.TemplateResponse` object (or equivalent) the :class:`~django.template.response.TemplateResponse` object (or equivalent)
@ -173,7 +173,7 @@ includes ``process_template_response()``.
``process_response`` ``process_response``
-------------------- --------------------
.. method:: process_response(self, request, response) .. method:: process_response(request, response)
``request`` is an :class:`~django.http.HttpRequest` object. ``response`` is ``request`` is an :class:`~django.http.HttpRequest` object. ``response`` is
the :class:`~django.http.HttpResponse` or the :class:`~django.http.HttpResponse` or
@ -230,7 +230,7 @@ must test for streaming responses and adjust their behavior accordingly::
``process_exception`` ``process_exception``
--------------------- ---------------------
.. method:: process_exception(self, request, exception) .. method:: process_exception(request, exception)
``request`` is an :class:`~django.http.HttpRequest` object. ``exception`` is an ``request`` is an :class:`~django.http.HttpRequest` object. ``exception`` is an
``Exception`` object raised by the view function. ``Exception`` object raised by the view function.

View File

@ -1241,7 +1241,7 @@ your test suite.
failure. Similar to unittest's :meth:`~unittest.TestCase.assertRaisesRegexp` failure. Similar to unittest's :meth:`~unittest.TestCase.assertRaisesRegexp`
with the difference that ``expected_message`` isn't a regular expression. with the difference that ``expected_message`` isn't a regular expression.
.. method:: SimpleTestCase.assertFieldOutput(self, fieldclass, valid, invalid, field_args=None, field_kwargs=None, empty_value=u'') .. method:: SimpleTestCase.assertFieldOutput(fieldclass, valid, invalid, field_args=None, field_kwargs=None, empty_value=u'')
Asserts that a form field behaves correctly with various inputs. Asserts that a form field behaves correctly with various inputs.