Last active
August 29, 2015 14:17
-
-
Save ConorMcGee/a7a915792cff6fcb80e6 to your computer and use it in GitHub Desktop.
Problem with Django rest swagger and get_serializer_class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_view_mocker(view): | |
view.request.tacos = 'Hi' | |
print "This is the viewmocker, just changed view.request.tacos to %s" % view.request.tacos | |
return view | |
class FileTree(generics.ListAPIView): | |
model = File | |
lookup_field = 'file_id' | |
paginate_by = 25 | |
paginate_by_param = 'items' | |
def get_serializer_class(self): | |
print "This is the get_serializer_class method, self.request.tacos is %s" % self.request.tacos | |
return FileTreeSerializer | |
def queryset(self): | |
return File.objects.all() | |
def get(self, request, *args, **kwargs): | |
""" | |
--- | |
view_mocker: my_view_mocker | |
""" | |
return super(FileTree, self).get(request, *args, **kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment