Пример #1
0
 def _wrapper(view, request, *args, **kwargs):
     view.query_data = request.query_data = RequestData(request,
                                                        is_query=True,
                                                        strict=strict)
     view.shift_data = request.shift_data = RequestData(request,
                                                        is_query=False,
                                                        strict=strict)
     return func(view, request, *args, **kwargs)
Пример #2
0
class PMixin(object):

    pagination_class = VueTablePagination

    def initial(self, request, *args, **kwargs):
        self.query_data = RequestData(request, is_query=True)
        self.shift_data = RequestData(request, is_query=False)
        self.query_data_fields = self.query_data.getlist('_fields')
        super(PMixin, self).initial(request, *args, **kwargs)

    def get_serializer(self, *args, **kwargs):
        serializer_class = self.get_serializer_class()
        context = self.get_serializer_context()
        kwargs['context'] = context
        if self.query_data_fields:
            kwargs['fields'] = self.query_data_fields
        return serializer_class(*args, **kwargs)
Пример #3
0
 def initial(self, request, *args, **kwargs):
     super(PGMixin, self).initial(request, *args, **kwargs)
     self.query_data = RequestData(request, is_query=True)
     self.shift_data = RequestData(request, is_query=False)
Пример #4
0
 def decorator(view, request, *args, **kwargs):
     request.query_data = RequestData(request, is_query=True)
     request.shift_data = RequestData(request, is_query=False)
     return func(view, request, *args, **kwargs)
Пример #5
0
 def initial(self, request, *args, **kwargs):
     self.query_data = RequestData(request, is_query=True)
     self.shift_data = RequestData(request, is_query=False)
     self.query_data_fields = self.query_data.getlist('_fields')
     super(PMixin, self).initial(request, *args, **kwargs)