#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:  Cleanup/optimization  |                   Status:  new
    Component:  Forms                 |                  Version:  1.9
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by charettes):

 * 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>
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/069.0caf5475a8f377983f9b9eed97e4fde6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to