Opened 6 years ago

Closed 6 years ago

#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: dev
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 by Claude Paroz, 6 years ago

Triage Stage: UnreviewedAccepted

Sure.

comment:2 by Cameron Curry, 6 years ago

Owner: changed from nobody to Cameron Curry
Status: newassigned

comment:3 by James Pic, 6 years ago

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 by Cameron Curry, 6 years ago

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 by Cameron Curry, 6 years ago

Has patch: set

in reply to:  4 comment:6 by Cameron Curry, 6 years ago

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 by Claude Paroz, 6 years ago

Triage Stage: AcceptedReady for checkin
Version: 2.0master

comment:8 by Tim Graham, 6 years ago

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

I added some documentation changes to the patch.

comment:9 by Tim Graham <timograham@…>, 6 years ago

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