django-rest-framework icon indicating copy to clipboard operation
django-rest-framework copied to clipboard

a viewset's action list gets "head" added to it, but only after being called at least once

Open rtpg opened this issue 6 months ago • 2 comments

https://github.com/encode/django-rest-framework/blame/853969c69c815be69513c2f63a41285858a45352/rest_framework/viewsets.py#L106-L107

We didn't have head set in our actions on a viewset, but head would suddenly appear in a viewset's actions, but seemingly randomly.

This way of filling in head in actions means that before you call a viewset at least once, it will have one set of actions, but afterwards it would have another.

This is surprising to me, and I have a hard time imagining it to be the right solution here. But perhaps I am missing a detail.

rtpg avatar Jul 25 '25 07:07 rtpg

Seems like this behaviour is due to what was done in https://github.com/encode/django-rest-framework/pull/7223 for https://github.com/encode/django-rest-framework/issues/6196

Do you have a suggestion on how to fix that?

browniebroke avatar Jul 25 '25 07:07 browniebroke

I guess the initial idea of changing SimpleRouter and action decorator was the better way to go with. I applied to changes here, it seems fine to me if you're fine with it I can open a PR @browniebroke .

Sajadrahimi avatar Aug 25 '25 14:08 Sajadrahimi

you can open a pr for review

auvipy avatar Dec 14 '25 13:12 auvipy