drf-dynamic-fields icon indicating copy to clipboard operation
drf-dynamic-fields copied to clipboard

"Fields" param in settings

Open plopidou opened this issue 7 years ago • 1 comments

Hello,

An idea that would be nice: the ability to set the GET param names in settings. Something like the default:

DRF_DYNAMIC_FIELDS_GET_NAMES = ['fields', 'omit]

Which could be overriden in the local settings with something like:

DRF_DYNAMIC_FIELDS_GET_NAMES = ['__fields', '__omit]

So that the risk of the GET param colliding with model fields named "fields" and "omit" is minimised when using drf_dynamic_fields alongside https://github.com/carltongibson/django-filter, for example.

Thanks!

plopidou avatar May 22 '18 18:05 plopidou

Sounds like a nice idea. Although a dictionary for configuration would probably be better:

DRF_DYNAMIC_FIELDS = {
    'GET_PARAMETERS': {
        'fields': '__fields',
        'omit': '__omit',
    },
}

Pull requests (including tests and documentation) are welcome. If someone has any questions regarding implementation, feel free to ask!

dbrgn avatar May 22 '18 21:05 dbrgn