chibisov / drf-extensions

DRF-extensions is a collection of custom extensions for Django REST Framework
http://chibisov.github.io/drf-extensions/docs
MIT License
1.48k stars 208 forks source link

Nested router lookup by multiple fields #332

Closed radokristof closed 2 years ago

radokristof commented 2 years ago

Right now, I'm using MultipleLookupFieldsMixin for enabling to lookup an object by multiple unique fields.

    lookup_fields = ["qr_id", "hashid", "uid"]
    lookup_value_regex = '(?P<qr_id>\\d{4}-.+)|(?P<uid>\\w{2}_.+_.+)|(?P<hashid>[a-zA-Z0-9]+)'

However with nested routes, I can only specify one parents_query_lookups. Is it somehow possible to use this mixin in the nested viewset as well, so it would work with all lookup field?

radokristof commented 2 years ago

I was able to achieve this by overriding the get_parents_query_dict method