#14380 closed (invalid)
Form provided by modelform_factory fails when using fields attribute
Reported by: | Olivier Le Thanh Duong | Owned by: | nobody |
---|---|---|---|
Component: | Forms | Version: | 1.2 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When creating a form using modelform_factory, setting the fields attribute and trying to display it, it fail with the following error :
AttributeError: 'NoneType' object has no attribute 'label'
Steps to reproduce :
- run manage.py shell
- import any model ex : from django.contrib.flatpages.models import FlatPage
- from django.forms.models import modelform_factory
- modelform_factory(FlatPage, fields='title')().as_p()
(or as_ul or as_table)
- > AttributeError: 'NoneType' object has no attribute 'label'
When not using this attribute or when using the excludes attribute this works as expected
Using django 1.2.3 here
Change History (3)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Per the docs, the fields argument expects a list, not a string.
comment:3 by , 14 years ago
Hum this was a error of retranscription when I wrote the bug, I had actually test it with a tuple like in the doc and it didn't work either.
However when testing with a proper list it is actually working. It seems a bit strange.
A friend can reproduce this bug using 1.1.1