Opened 7 years ago
Closed 7 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 )
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 , 7 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 7 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.
follow-up: 6 comment:4 by , 7 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:6 by , 7 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 , 7 years ago
Triage Stage: | Accepted → Ready for checkin |
---|---|
Version: | 2.0 → master |
comment:8 by , 7 years ago
Description: | modified (diff) |
---|---|
Summary: | BinaryField enforces editable=False → Allow BinaryField to be editable=True |
I added some documentation changes to the patch.
Sure.