Trying to change object_name
is a really bad idea. It is listed in Model._meta
, as you say, but it is not one of the documented metadata available . Trying to change it can cause things to break.
I do not understand why it is so important to change it. It does not appear publicly, so it really doesn't matter if it has an underscore or not. In the comment below, you indicate that object_name
used by CBV, but I would use documented ways to change context_object_name
in CBV instead of trying to change it on a model
If you need to change it to a model, you probably have to hack django.db.models.options
. You can try the DEFAULT_PARAMS
monkey patch so that you can set object_name
in the Meta
model class.
source share