Loading docs/howto/custom-model-fields.txt +11 −11 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ approximately decreasing order of importance, so start from the top. 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`, taking into account the connection object, and the settings associated with it. Loading Loading @@ -418,7 +418,7 @@ get out of the way. 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 object. Loading Loading @@ -479,7 +479,7 @@ automatically. 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 database backends (as opposed to serialization). The ``value`` Loading @@ -504,7 +504,7 @@ For example:: 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 before they can be used by a database backend. Loading @@ -520,7 +520,7 @@ already been passed through :meth:`.get_prep_value` conversions. When initial data conversions before performing any database-specific 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 the database. As the default implementation just calls Loading @@ -532,7 +532,7 @@ parameters (which is implemented by :meth:`.get_db_prep_value`). 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 the value of the appropriate attribute from ``model_instance`` for this field. Loading @@ -558,7 +558,7 @@ Preparing values for use in database lookups As with value conversions, preparing a value for database lookups is a 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, performing generic data validity checks Loading Loading @@ -606,7 +606,7 @@ accepted lookup types to ``exact`` and ``in``:: else: 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. As with :meth:`.get_db_prep_value`, the specific connection that will Loading @@ -617,7 +617,7 @@ prepared with :meth:`.get_prep_lookup`. Specifying the form field for a model field ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. method:: Field.formfield(self, form_class=forms.CharField, **kwargs) .. method:: Field.formfield(form_class=forms.CharField, **kwargs) Returns the default form field to use when this field is displayed in a model. This method is called by the :class:`~django.forms.ModelForm` helper. Loading Loading @@ -652,7 +652,7 @@ fields. 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` subclass we are emulating at the database level. This is used to determine the Loading Loading @@ -686,7 +686,7 @@ output in some other place, outside of Django. 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 output. Calling ``Field._get_val_from_obj(obj)`` is the best way to get the Loading docs/howto/error-reporting.txt +4 −4 Original line number Diff line number Diff line Loading @@ -256,24 +256,24 @@ following methods: .. class:: SafeExceptionReporterFilter .. method:: SafeExceptionReporterFilter.is_active(self, request) .. method:: SafeExceptionReporterFilter.is_active(request) Returns ``True`` to activate the filtering operated in the other methods. 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 value that would be returned by ``repr(request)``, except it uses the filtered dictionary of POST parameters as determined by :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 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 frame. By default it replaces the values of sensitive variables with stars Loading docs/ref/contrib/admin/index.txt +31 −31 Original line number Diff line number Diff line Loading @@ -1009,7 +1009,7 @@ templates used by the :class:`ModelAdmin` views: save/delete the object, they are not for veto purposes, rather they allow 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, a ``ModelForm`` instance and a boolean value based on whether it is adding Loading @@ -1022,12 +1022,12 @@ templates used by the :class:`ModelAdmin` views: obj.user = request.user 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 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 ``ModelForm`` instance and a boolean value based on whether it is adding or Loading @@ -1044,7 +1044,7 @@ templates used by the :class:`ModelAdmin` views: instance.save() formset.save_m2m() .. method:: ModelAdmin.get_ordering(self, request) .. method:: ModelAdmin.get_ordering(request) .. versionadded:: 1.4 Loading @@ -1060,7 +1060,7 @@ templates used by the :class:`ModelAdmin` views: else: return ['name'] .. method:: ModelAdmin.save_related(self, request, form, formsets, change) .. method:: ModelAdmin.save_related(request, form, formsets, change) .. versionadded:: 1.4 Loading @@ -1070,14 +1070,14 @@ templates used by the :class:`ModelAdmin` views: 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. .. 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 ``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, 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) .. versionadded:: 1.4 Loading @@ -1086,7 +1086,7 @@ templates used by the :class:`ModelAdmin` views: a ``dictionary``, as described above in the :attr:`ModelAdmin.prepopulated_fields` section. .. method:: ModelAdmin.get_list_display(self, request) .. method:: ModelAdmin.get_list_display(request) .. versionadded:: 1.4 Loading @@ -1095,7 +1095,7 @@ templates used by the :class:`ModelAdmin` views: displayed on the changelist view as described above in the :attr:`ModelAdmin.list_display` section. .. method:: ModelAdmin.get_list_display_links(self, request, list_display) .. method:: ModelAdmin.get_list_display_links(request, list_display) .. versionadded:: 1.4 Loading @@ -1105,14 +1105,14 @@ templates used by the :class:`ModelAdmin` views: changelist that will be linked to the change view, as described in the :attr:`ModelAdmin.list_display_links` 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`` 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 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) .. versionadded:: 1.5 Loading @@ -1120,7 +1120,7 @@ templates used by the :class:`ModelAdmin` views: to return the same kind of sequence type as for the :attr:`~ModelAdmin.list_filter` attribute. .. method:: ModelAdmin.get_inline_instances(self, request, obj=None) .. method:: ModelAdmin.get_inline_instances(request, obj=None) .. versionadded:: 1.5 Loading @@ -1130,7 +1130,7 @@ templates used by the :class:`ModelAdmin` views: objects, as described below in the :class:`~django.contrib.admin.InlineModelAdmin` section. .. method:: ModelAdmin.get_urls(self) .. method:: ModelAdmin.get_urls() 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 Loading Loading @@ -1195,7 +1195,7 @@ templates used by the :class:`ModelAdmin` views: (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 and change views, see :meth:`add_view` and :meth:`change_view`. Loading @@ -1210,7 +1210,7 @@ templates used by the :class:`ModelAdmin` views: self.exclude.append('field_to_hide') return super(MyModelAdmin, self).get_form(request, obj, **kwargs) .. method:: ModelAdmin.get_formsets(self, request, obj=None) .. method:: ModelAdmin.get_formsets(request, obj=None) Yields :class:`InlineModelAdmin`\s for use in admin add and change views. Loading @@ -1227,7 +1227,7 @@ templates used by the :class:`ModelAdmin` views: continue yield inline.get_formset(request, obj) .. 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 override the default formfield for a foreign keys field. For example, to Loading @@ -1242,7 +1242,7 @@ templates used by the :class:`ModelAdmin` views: This uses the ``HttpRequest`` instance to filter the ``Car`` foreign key 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 ``formfield_for_manytomany`` method can be overridden to change the Loading @@ -1257,7 +1257,7 @@ templates used by the :class:`ModelAdmin` views: kwargs["queryset"] = Car.objects.filter(owner=request.user) 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`` methods, the ``formfield_for_choice_field`` method can be overridden to Loading @@ -1276,13 +1276,13 @@ templates used by the :class:`ModelAdmin` views: kwargs['choices'] += (('ready', 'Ready for deployment'),) return super(MyModelAdmin, self).formfield_for_choice_field(db_field, request, **kwargs) .. method:: ModelAdmin.get_changelist(self, request, **kwargs) .. method:: ModelAdmin.get_changelist(request, **kwargs) Returns the ``Changelist`` class to be used for listing. By default, ``django.contrib.admin.views.main.ChangeList`` is used. By inheriting this 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`` on the changelist page. To use a custom form, for example:: Loading @@ -1295,7 +1295,7 @@ templates used by the :class:`ModelAdmin` views: def get_changelist_form(self, request, **kwargs): return MyForm .. 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 changelist page if :attr:`~ModelAdmin.list_editable` is used. To use a Loading @@ -1311,12 +1311,12 @@ templates used by the :class:`ModelAdmin` views: kwargs['formset'] = MyAdminFormSet 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`` 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. If obj is ``None``, should return ``True`` or ``False`` to indicate whether Loading @@ -1324,7 +1324,7 @@ templates used by the :class:`ModelAdmin` views: will be interpreted as meaning that the current user is not permitted to 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. If obj is ``None``, should return ``True`` or ``False`` to indicate whether Loading @@ -1332,7 +1332,7 @@ templates used by the :class:`ModelAdmin` views: be interpreted as meaning that the current user is not permitted to delete any object of this type). .. method:: ModelAdmin.queryset(self, request) .. method:: ModelAdmin.queryset(request) The ``queryset`` method on a ``ModelAdmin`` returns a :class:`~django.db.models.query.QuerySet` of all model instances that Loading Loading @@ -1368,11 +1368,11 @@ templates used by the :class:`ModelAdmin` views: 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. .. 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. Loading @@ -1380,17 +1380,17 @@ Other methods The ``form_url`` parameter was added. .. 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 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 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 model instance. Loading Loading @@ -1651,7 +1651,7 @@ The ``InlineModelAdmin`` class adds: Specifies whether or not inline objects can be deleted in the inline. 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 admin add/change views. See the example for Loading docs/ref/contrib/auth.txt +1 −1 Original line number Diff line number Diff line Loading @@ -260,7 +260,7 @@ Manager methods 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 :attr:`~models.User.is_superuser` to ``True``. Loading docs/ref/contrib/gis/gdal.txt +1 −1 Original line number Diff line number Diff line Loading @@ -873,7 +873,7 @@ systems and coordinate transformation:: 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 ========================= Loading Loading
docs/howto/custom-model-fields.txt +11 −11 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ approximately decreasing order of importance, so start from the top. 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`, taking into account the connection object, and the settings associated with it. Loading Loading @@ -418,7 +418,7 @@ get out of the way. 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 object. Loading Loading @@ -479,7 +479,7 @@ automatically. 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 database backends (as opposed to serialization). The ``value`` Loading @@ -504,7 +504,7 @@ For example:: 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 before they can be used by a database backend. Loading @@ -520,7 +520,7 @@ already been passed through :meth:`.get_prep_value` conversions. When initial data conversions before performing any database-specific 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 the database. As the default implementation just calls Loading @@ -532,7 +532,7 @@ parameters (which is implemented by :meth:`.get_db_prep_value`). 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 the value of the appropriate attribute from ``model_instance`` for this field. Loading @@ -558,7 +558,7 @@ Preparing values for use in database lookups As with value conversions, preparing a value for database lookups is a 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, performing generic data validity checks Loading Loading @@ -606,7 +606,7 @@ accepted lookup types to ``exact`` and ``in``:: else: 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. As with :meth:`.get_db_prep_value`, the specific connection that will Loading @@ -617,7 +617,7 @@ prepared with :meth:`.get_prep_lookup`. Specifying the form field for a model field ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. method:: Field.formfield(self, form_class=forms.CharField, **kwargs) .. method:: Field.formfield(form_class=forms.CharField, **kwargs) Returns the default form field to use when this field is displayed in a model. This method is called by the :class:`~django.forms.ModelForm` helper. Loading Loading @@ -652,7 +652,7 @@ fields. 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` subclass we are emulating at the database level. This is used to determine the Loading Loading @@ -686,7 +686,7 @@ output in some other place, outside of Django. 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 output. Calling ``Field._get_val_from_obj(obj)`` is the best way to get the Loading
docs/howto/error-reporting.txt +4 −4 Original line number Diff line number Diff line Loading @@ -256,24 +256,24 @@ following methods: .. class:: SafeExceptionReporterFilter .. method:: SafeExceptionReporterFilter.is_active(self, request) .. method:: SafeExceptionReporterFilter.is_active(request) Returns ``True`` to activate the filtering operated in the other methods. 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 value that would be returned by ``repr(request)``, except it uses the filtered dictionary of POST parameters as determined by :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 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 frame. By default it replaces the values of sensitive variables with stars Loading
docs/ref/contrib/admin/index.txt +31 −31 Original line number Diff line number Diff line Loading @@ -1009,7 +1009,7 @@ templates used by the :class:`ModelAdmin` views: save/delete the object, they are not for veto purposes, rather they allow 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, a ``ModelForm`` instance and a boolean value based on whether it is adding Loading @@ -1022,12 +1022,12 @@ templates used by the :class:`ModelAdmin` views: obj.user = request.user 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 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 ``ModelForm`` instance and a boolean value based on whether it is adding or Loading @@ -1044,7 +1044,7 @@ templates used by the :class:`ModelAdmin` views: instance.save() formset.save_m2m() .. method:: ModelAdmin.get_ordering(self, request) .. method:: ModelAdmin.get_ordering(request) .. versionadded:: 1.4 Loading @@ -1060,7 +1060,7 @@ templates used by the :class:`ModelAdmin` views: else: return ['name'] .. method:: ModelAdmin.save_related(self, request, form, formsets, change) .. method:: ModelAdmin.save_related(request, form, formsets, change) .. versionadded:: 1.4 Loading @@ -1070,14 +1070,14 @@ templates used by the :class:`ModelAdmin` views: 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. .. 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 ``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, 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) .. versionadded:: 1.4 Loading @@ -1086,7 +1086,7 @@ templates used by the :class:`ModelAdmin` views: a ``dictionary``, as described above in the :attr:`ModelAdmin.prepopulated_fields` section. .. method:: ModelAdmin.get_list_display(self, request) .. method:: ModelAdmin.get_list_display(request) .. versionadded:: 1.4 Loading @@ -1095,7 +1095,7 @@ templates used by the :class:`ModelAdmin` views: displayed on the changelist view as described above in the :attr:`ModelAdmin.list_display` section. .. method:: ModelAdmin.get_list_display_links(self, request, list_display) .. method:: ModelAdmin.get_list_display_links(request, list_display) .. versionadded:: 1.4 Loading @@ -1105,14 +1105,14 @@ templates used by the :class:`ModelAdmin` views: changelist that will be linked to the change view, as described in the :attr:`ModelAdmin.list_display_links` 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`` 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 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) .. versionadded:: 1.5 Loading @@ -1120,7 +1120,7 @@ templates used by the :class:`ModelAdmin` views: to return the same kind of sequence type as for the :attr:`~ModelAdmin.list_filter` attribute. .. method:: ModelAdmin.get_inline_instances(self, request, obj=None) .. method:: ModelAdmin.get_inline_instances(request, obj=None) .. versionadded:: 1.5 Loading @@ -1130,7 +1130,7 @@ templates used by the :class:`ModelAdmin` views: objects, as described below in the :class:`~django.contrib.admin.InlineModelAdmin` section. .. method:: ModelAdmin.get_urls(self) .. method:: ModelAdmin.get_urls() 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 Loading Loading @@ -1195,7 +1195,7 @@ templates used by the :class:`ModelAdmin` views: (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 and change views, see :meth:`add_view` and :meth:`change_view`. Loading @@ -1210,7 +1210,7 @@ templates used by the :class:`ModelAdmin` views: self.exclude.append('field_to_hide') return super(MyModelAdmin, self).get_form(request, obj, **kwargs) .. method:: ModelAdmin.get_formsets(self, request, obj=None) .. method:: ModelAdmin.get_formsets(request, obj=None) Yields :class:`InlineModelAdmin`\s for use in admin add and change views. Loading @@ -1227,7 +1227,7 @@ templates used by the :class:`ModelAdmin` views: continue yield inline.get_formset(request, obj) .. 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 override the default formfield for a foreign keys field. For example, to Loading @@ -1242,7 +1242,7 @@ templates used by the :class:`ModelAdmin` views: This uses the ``HttpRequest`` instance to filter the ``Car`` foreign key 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 ``formfield_for_manytomany`` method can be overridden to change the Loading @@ -1257,7 +1257,7 @@ templates used by the :class:`ModelAdmin` views: kwargs["queryset"] = Car.objects.filter(owner=request.user) 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`` methods, the ``formfield_for_choice_field`` method can be overridden to Loading @@ -1276,13 +1276,13 @@ templates used by the :class:`ModelAdmin` views: kwargs['choices'] += (('ready', 'Ready for deployment'),) return super(MyModelAdmin, self).formfield_for_choice_field(db_field, request, **kwargs) .. method:: ModelAdmin.get_changelist(self, request, **kwargs) .. method:: ModelAdmin.get_changelist(request, **kwargs) Returns the ``Changelist`` class to be used for listing. By default, ``django.contrib.admin.views.main.ChangeList`` is used. By inheriting this 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`` on the changelist page. To use a custom form, for example:: Loading @@ -1295,7 +1295,7 @@ templates used by the :class:`ModelAdmin` views: def get_changelist_form(self, request, **kwargs): return MyForm .. 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 changelist page if :attr:`~ModelAdmin.list_editable` is used. To use a Loading @@ -1311,12 +1311,12 @@ templates used by the :class:`ModelAdmin` views: kwargs['formset'] = MyAdminFormSet 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`` 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. If obj is ``None``, should return ``True`` or ``False`` to indicate whether Loading @@ -1324,7 +1324,7 @@ templates used by the :class:`ModelAdmin` views: will be interpreted as meaning that the current user is not permitted to 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. If obj is ``None``, should return ``True`` or ``False`` to indicate whether Loading @@ -1332,7 +1332,7 @@ templates used by the :class:`ModelAdmin` views: be interpreted as meaning that the current user is not permitted to delete any object of this type). .. method:: ModelAdmin.queryset(self, request) .. method:: ModelAdmin.queryset(request) The ``queryset`` method on a ``ModelAdmin`` returns a :class:`~django.db.models.query.QuerySet` of all model instances that Loading Loading @@ -1368,11 +1368,11 @@ templates used by the :class:`ModelAdmin` views: 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. .. 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. Loading @@ -1380,17 +1380,17 @@ Other methods The ``form_url`` parameter was added. .. 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 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 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 model instance. Loading Loading @@ -1651,7 +1651,7 @@ The ``InlineModelAdmin`` class adds: Specifies whether or not inline objects can be deleted in the inline. 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 admin add/change views. See the example for Loading
docs/ref/contrib/auth.txt +1 −1 Original line number Diff line number Diff line Loading @@ -260,7 +260,7 @@ Manager methods 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 :attr:`~models.User.is_superuser` to ``True``. Loading
docs/ref/contrib/gis/gdal.txt +1 −1 Original line number Diff line number Diff line Loading @@ -873,7 +873,7 @@ systems and coordinate transformation:: 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 ========================= Loading