Django rest framework uses cls and initkwargs to provide a reference to the class the view function originates from:
But django uses Django view_class and view_initkwargs:
https://github.com/django/django/blob/0315c18fe170b1b611b7d10b5dde2f196b89a7e0/django/views/generic/base.py#L72-L73
(added in commit a420f83e7d2e446ca01ef7c13d30c2ef3e975e5c, Django issue #24055.)
It would be nice if DRF and Django behave the same in this regard. Would you consider merging a patch changing DRF to use view_class/view_initkwargs?
As both are attributes to the view function, it seems redundant to prefix them with view_ IMO.
That sounds reasonable to me. I'm not clear about whether it requires to follow the deprecation path or not.
Maybe this should be other way around. And django should be fixed instead?
I find it unlikely that this change would be accepted in Django. That said, if you do open a ticket for this, please link it here.
In regards to deprecation, I had previously implemented RenameAttributesBase for django-filter (which is based on Django's RenameMethodsBase), but it might need some polish.
If there鈥檚 a change on, we鈥檒l do it here not in Django.
Hi, @carltongibson! I do understand that this naming works ok in django. And django should change it's API as less as possible. But shouldn't there be a process to rename something if it has some redundancy or wasn't chosen properly to begin with?
@imomaliev There is. It just doesn鈥檛 apply in this case. If this is to progress, it鈥檒l be done here rather than in Django.
But we should make sure any changes properly follow the depreciation policy.
I think the downsides of changing this on our side probably outweigh the benefits. We'd likely end up breaking a bunch of user code as a result.