-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make DRF browsable API Interfaces for filters #128
Comments
@iamtio that's a neat snippet, thanks for sharing! FYI I got it to work like so:
api.py: I changed your template string to be a Template, and template_render to Template.render().
Now someone make this into a little leaflet map to draw the bbox and we're cookin'! |
Sorry if this is the wrong place to report this, but I am interested in having this as well for the standard GeometryFilter as well as the InBBoxFilter. It also seems to be almost there already... I notice that the GeometryFilter defines a custom widget, but uses the BaseGeometryWidget from the django gis forms. When I try and browse the api section with this filter using DRF interface, I get an error about the template name being a folder, presumably as the BaseGeometryWidget does not define an actual template. I tried substituting OpenLayersWidget for BaseGeometryWidget in the GeometryFilter's init call, and that stops the error showing, but judging by the javascript errors I then see on the console, it looks like it is not including the pre-requisite javascript definitions from the Media subclass in the OpenLayersWidget class from the gis form widgets. I am now kinda stuck, as I do not understand the internals of how the DRF api browsing pages are put together, and how that Javascript is supposed to end up getting included. Any thoughts or ideas? Is this a sensible approach or am I barking completely up the wrong tree? Apologies if any of this is unclear, I am completely new to DRF in general, and this GIS extension in particular - however, if someone could explain how this should be done I would be more than happy to try and implement it and submit a pull request! |
@blueyed do you have any useful suggestion for @sebclarke? |
@nemesisdesign |
Can anyone make DRF browsable API Interfaces for filters like django-filter have? It would be cool feature.
My example
The text was updated successfully, but these errors were encountered: