#26238: confusing error message: django.core.exceptions.FieldError: Unknown
field(s) specified when including a BinaryField in ModelForm.Meta.fields
-------------------------------+--------------------
Reporter: groovecoder | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I had a `Model` with a `CharField`:
{{{
class PushApplication(models.Model):
jws_key = models.CharField(blank=True, max_length=255)
}}}
I changed it to a `BinaryField`:
{{{
class PushApplication(models.Model):
jws_key = models.BinaryField(blank=True)
}}}
When I tried to run makemigrations:
{{{
$ python manage.py makemigrations
...
django.core.exceptions.FieldError: Unknown field(s) (jws_key) specified
for PushApplication
}}}
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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.e8bcf3ea55d8406c93b90221c8861517%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.