The problem was that I had a `ModelForm` with `jws_key` in the fields:
{{{
class PushAppForm(ModelForm):
class Meta:
fields = ['name', 'jws_key']
}}}
I removed `jws_key` from the `ModelForm` and it works.
But the error message sent me on an hour long web search trying to find
out why changing a `CharField` to `BinaryField` would break migrations.
--
Ticket URL: <https://code.djangoproject.com/ticket/26238>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* component: Uncategorized => Forms
* needs_tests: => 0
* needs_docs: => 0
* type: Uncategorized => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
Hi groovecoder,
In fact the exception you encountered has nothing to do with
`makemigrations`; you should be able to also trigger it by simply
importing the module defining the `PushAppForm` form class.
The reason behind the `FieldError` on `PushAppForm` creation is the fact
`BinaryField` are not
[https://docs.djangoproject.com/en/1.9/ref/models/fields/#editable
editable] by default for obvious reasons and such fields are ignored by
[https://docs.djangoproject.com/en/1.9/topics/forms/modelforms/#selecting-
the-fields-to-use model forms].
I suggest we adjust the message of the `FieldError` raised when an
existing `editable=False` field is explicitly specified through
`Meta.fields` and amend the `BinaryField`'s limitations documentation to
also mention it can't be used in forms by default.
--
Ticket URL: <https://code.djangoproject.com/ticket/26238#comment:1>
* has_patch: 0 => 1
* version: 1.9 => master
Comment:
[https://github.com/django/django/pull/6170 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/26238#comment:2>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/26238#comment:3>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"d43156e1e984d7e0848b7d4db218877a29d617b4" d43156e1]:
{{{
#!CommitTicketReference repository=""
revision="d43156e1e984d7e0848b7d4db218877a29d617b4"
Fixed #26238 -- Raised explicit error for non-editable field in ModelForm
Thanks Luke Crouch for the report and Simon Charette for the review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26238#comment:4>