-
Notifications
You must be signed in to change notification settings - Fork 184
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
DRFDocs not showing delete, post, etc. options but regular docs do? #173
Comments
Same here, |
still an issue on drfdocs: 0.0.11 but still an issue: edit edit 2 def is_method_allowed(self, callback_cls, method_name):
has_attr = hasattr(callback_cls, method_name)
viewset_method = ( (issubclass(callback_cls, ModelViewSet) or
issubclass(callback_cls, GenericViewSet))and # fix for GenericViewSet
method_name in VIEWSET_METHODS.get(self.callback.suffix, []))
try: # fix for detail_routes and list_routes
b = method_name in self.callback.actions
except AttributeError:
b = False
return has_attr or viewset_method or b its probably not the nicest way to do it, but it works for me |
@soraphis thanks! Can you fork + make a PR for this? |
there already is a PR open that should fix this: #132 and it should be noted, that i've made a dirty fix for the most obvious probablems, but there are still problems left regarding this, e.g.: class MyViewSet(viewsets.ModelViewSet):
serializer_class = ser.MySerializer
# ...
@detail_route(methods=['post'], serializer_class=ser.AnotherSerializer)
def my_detail_route(self, request, pk=None):
# ... my quick-and-dirty fix will not show the serializer fields of it currently does not bother me enough to fix this - sorry. but for a PR this should be addressed too! |
Using this combination of classes seems to work: from rest_framework.viewsets import GenericViewSet
from rest_framework.generics import ListAPIView, CreateAPIView, RetrieveAPIView, DestroyAPIView
class DataViewSet(ListAPIView, CreateAPIView, RetrieveAPIView, DestroyAPIView, GenericViewSet):
pass I think that this is about the same behavior, just different classes.. that seem to work? This is for a simple dummy app that does nothing, so I'm not sure if this breaks other things. |
Guys after a month someone could tell me if this is fixed? I'm struggling to make it works! |
No, no updates here. We need a way to help maintainers get updates through... some kind of reward system... |
Heyo! Thanks so much for releasing this, it is beautiful.
I am a little confused on why I'm not seeing POST/DELETE/etc. on the DRF docs version, but I can see it on the regular API docs:
Looks like I can only do GET/OPTIONS?
Here's some code:
It's probably something silly I'm overlooking, thanks!
The text was updated successfully, but these errors were encountered: