[Django]-Specifying parameters in tastypie-swagger

2👍

The parameters are retrieved from filtering specified in the Meta of class inherited from Resource. There seems to be a small bug in django-tastypie-swagger as it doesn’t recognize filters if it is specified as tuples. We need to specify filtering as lists. For e.g.

class VideoById(Resource):
    class Meta:
        filtering = {
            "filter1": ['exact', ],
            "filter2": ['exact', ],
        }

The above mentioned code works. But the following won’t:

class VideoById(Resource):
    class Meta:
        filtering = {
                "filter1": ('exact', ),
                "filter2": ('exact', ),
            }

1👍

Update the django-tastypie-swagger to development version or change the line 181 of mapping.py

From

if isinstance(field, list):

To

if isinstance(field, (list, tuple, set)):

Leave a comment