Fix issues with routers for custom list-route and detail-routes by vikalpj · Pull Request #4229 · encode/django-rest-framework (original) (raw)
@tomchristie so basically I have multiple list routes in the View set and its tested against the loop. Here known host is the iterable and is good for 1 use only.
When the method loop runs and tests for both the methods (update and hello_rest). and it runs 1st for hello_rest and checks the condition correctly. but after this point known_host iterable would be a blank list [].
Now when it tests against update methods, likeif 'update' in []:
this condition would always be false and the exception is never raised.
I had an issue removing a unused route from the codebase where my update function was already overridden as in the example above...
This pull request, forcefully converts the iterator to list, so that this check never fails for the predefined methods.