django-deprecate-fields
django-deprecate-fields copied to clipboard
deprecate_field: accessing deprecated field NoneType.<unknown>
We started used deprecate-fields and saw this warning in our logs.
Turns out django-fsm uses inspect.getmembers
which in turn does a getattr(object, key)
where the object is the class, not an instance.
Maybe simply catching the None value at the start would be enough.
This can also happen when you add a deprecated field to an admin.ModelAdmin.list_display
Workaround:
To find the problematic model, you can:
- put a breakpoint in
django_deprecate_fields/deprecate_field.py
DeprecatedField.__get__
- move up the call stack to
django/contrib/adminchecks.py
_check_list_display_item
- inspect
obj