1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #28937 -- Allowed BinaryField to be editable=True.

This commit is contained in:
Cameron Curry
2017-12-18 21:19:57 +01:00
committed by Tim Graham
parent 9f7772e098
commit 622ead6aaf
7 changed files with 35 additions and 4 deletions

View File

@@ -420,8 +420,14 @@ guaranteed to fit numbers from ``-9223372036854775808`` to
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
to filter a queryset on a ``BinaryField`` value. It is also not possible to
include a ``BinaryField`` in a :class:`~django.forms.ModelForm`.
to filter a queryset on a ``BinaryField`` value.
By default, ``BinaryField`` sets :attr:`~Field.editable` to ``False``, in which
case it can't be included in a :class:`~django.forms.ModelForm`.
.. versionchanged:: 2.1
Older versions don't allow setting ``editable`` to ``True``.
.. admonition:: Abusing ``BinaryField``

View File

@@ -157,6 +157,9 @@ Models
* Models can now use ``__init_subclass__()`` from :pep:`487`.
* A ``BinaryField`` may now be set to ``editable=True`` if you wish to include
it in model forms.
Requests and Responses
~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -62,6 +62,11 @@ Model field Form field
``min_value`` set to -9223372036854775808
and ``max_value`` set to 9223372036854775807.
:class:`BinaryField` :class:`~django.forms.CharField`, if
:attr:`~.Field.editable` is set to
``True`` on the model field, otherwise not
represented in the form.
:class:`BooleanField` :class:`~django.forms.BooleanField`
:class:`CharField` :class:`~django.forms.CharField` with