[Django] #28937: BinaryField enforces editable=False

13 views
Skip to first unread message

Django

unread,
Dec 18, 2017, 5:07:29 AM12/18/17
to django-...@googlegroups.com
#28937: BinaryField enforces editable=False
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: New | Status: new
feature |
Component: Database | Version: 2.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
Currently, it's hard to make a BinaryField subclass which has an upload
widget because it hardcodes editable=False:
https://github.com/django/django/blob/master/django/db/models/fields/__init__.py#L2298

Can we replace this with kwargs.setdefault('editable', False) ?

Thanks

--
Ticket URL: <https://code.djangoproject.com/ticket/28937>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 18, 2017, 9:12:43 AM12/18/17
to django-...@googlegroups.com
#28937: BinaryField enforces editable=False
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* stage: Unreviewed => Accepted


Comment:

Sure.

--
Ticket URL: <https://code.djangoproject.com/ticket/28937#comment:1>

Django

unread,
Dec 18, 2017, 11:26:55 AM12/18/17
to django-...@googlegroups.com
#28937: BinaryField enforces editable=False
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Cameron
| Curry
Type: New feature | Status: assigned

Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Cameron Curry):

* status: new => assigned
* owner: nobody => Cameron Curry


--
Ticket URL: <https://code.djangoproject.com/ticket/28937#comment:2>

Django

unread,
Dec 18, 2017, 11:38:00 AM12/18/17
to django-...@googlegroups.com
#28937: BinaryField enforces editable=False
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Cameron
| Curry
Type: New feature | Status: assigned
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by James Pic):

Thanks ! Note that BinaryField.deconstruct() also expects some hack with
editable, which i could circumvent it be setting def deconstruct(self):
models.Field.deconstruct(self), so, some change might be needed here too.

--
Ticket URL: <https://code.djangoproject.com/ticket/28937#comment:3>

Django

unread,
Dec 18, 2017, 12:58:00 PM12/18/17
to django-...@googlegroups.com
#28937: BinaryField enforces editable=False
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Cameron
| Curry
Type: New feature | Status: assigned
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Cameron Curry):

Hi James could you clarify a bit what you mean? I'm planning on following
the same pattern as URLField.deconstruct and FilePathField.deconstruct in
BinaryField.deconstruct, as in:
def deconstruct:
...
if kwargs.get('editable') is False: del kwargs!['editable']
...

would this do the trick?

--
Ticket URL: <https://code.djangoproject.com/ticket/28937#comment:4>

Django

unread,
Dec 18, 2017, 3:57:23 PM12/18/17
to django-...@googlegroups.com
#28937: BinaryField enforces editable=False
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Cameron
| Curry
Type: New feature | Status: assigned
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Cameron Curry):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/9476 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/28937#comment:5>

Django

unread,
Dec 18, 2017, 3:58:25 PM12/18/17
to django-...@googlegroups.com
#28937: BinaryField enforces editable=False
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Cameron
| Curry
Type: New feature | Status: assigned
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Cameron Curry):

Replying to [comment:4 Cameron Curry]:


> Hi James could you clarify a bit what you mean? I'm planning on
following the same pattern as URLField.deconstruct and
FilePathField.deconstruct in BinaryField.deconstruct, as in:
> def deconstruct:
> ...
> if kwargs.get('editable') is False: del kwargs!['editable']
> ...
>
> would this do the trick?

never mind I think I get it

--
Ticket URL: <https://code.djangoproject.com/ticket/28937#comment:6>

Django

unread,
Dec 19, 2017, 3:13:45 AM12/19/17
to django-...@googlegroups.com
#28937: BinaryField enforces editable=False
-------------------------------------+-------------------------------------
Reporter: James Pic | Owner: Cameron
| Curry
Type: New feature | Status: assigned
Component: Database layer | Version: master

(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* version: 2.0 => master
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/28937#comment:7>

Django

unread,
Dec 22, 2017, 5:42:03 PM12/22/17
to django-...@googlegroups.com
#28937: Allow BinaryField to be editable=True
-------------------------------------+-------------------------------------

Reporter: James Pic | Owner: Cameron
| Curry
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Old description:

> Currently, it's hard to make a BinaryField subclass which has an upload
> widget because it hardcodes editable=False:
> https://github.com/django/django/blob/master/django/db/models/fields/__init__.py#L2298
>
> Can we replace this with kwargs.setdefault('editable', False) ?
>
> Thanks

New description:

Currently, it's hard to make a BinaryField subclass which has an upload
widget because it

[https://github.com/django/django/blob/master/django/db/models/fields/__init__.py#L2298
hardcodes editable=False].

Can we replace this with `kwargs.setdefault('editable', False)` ?

Thanks

--

Comment (by Tim Graham):

I added some documentation changes to the patch.

--
Ticket URL: <https://code.djangoproject.com/ticket/28937#comment:8>

Django

unread,
Dec 22, 2017, 6:20:29 PM12/22/17
to django-...@googlegroups.com
#28937: Allow BinaryField to be editable=True
-------------------------------------+-------------------------------------

Reporter: James Pic | Owner: Cameron
| Curry
Type: New feature | Status: closed

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"622ead6aaf55288cd355f22e8bb9c56d8e12556c" 622ead6]:
{{{
#!CommitTicketReference repository=""
revision="622ead6aaf55288cd355f22e8bb9c56d8e12556c"
Fixed #28937 -- Allowed BinaryField to be editable=True.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28937#comment:9>

Reply all
Reply to author
Forward
0 new messages