#28937 closed New feature (fixed)

Allow BinaryField to be editable=True

Reported by: James Pic Owned by: Cameron Curry
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Tim Graham)

Currently, it's hard to make a BinaryField subclass which has an upload widget because it hardcodes editable=False.

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

Thanks

Change History (9)

comment:1 Changed 14 months ago by Claude Paroz

Triage Stage: UnreviewedAccepted

Sure.

comment:2 Changed 14 months ago by Cameron Curry

Owner: changed from nobody to Cameron Curry
Status: newassigned

comment:3 Changed 14 months ago 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.

comment:4 Changed 14 months ago 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?

comment:5 Changed 14 months ago by Cameron Curry

Has patch: set

comment:6 in reply to:  4 Changed 14 months ago by Cameron Curry

Replying to 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

comment:7 Changed 14 months ago by Claude Paroz

Triage Stage: AcceptedReady for checkin
Version: 2.0master

comment:8 Changed 14 months ago by Tim Graham

Description: modified (diff)
Summary: BinaryField enforces editable=FalseAllow BinaryField to be editable=True

I added some documentation changes to the patch.

comment:9 Changed 14 months ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 622ead6:

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

Note: See TracTickets for help on using tickets.
Back to Top