0

I am using the django http condition to set the last_modified and e_tag headers. Here is my set up:

def my_last_modified(request, *args, **kwargs):
    return None

def get_etag_key(request, *args, **kwargs):
    return None

class ProductsListAPIView(ListAPIView):
    queryset = Product.objects.active() # I want to get this value in the functions
    serializer_class = ProductSerializer

    @condition(etag_func=get_etag_key, last_modified_func=my_last_modified)
    def get(self, *args, **kwargs):
        return super(ProductsListAPIView, self).get(*args, **kwargs)

What I want to do is get this variable queryset from the main class in the get_etag_key and my_last_modified functions.

Is there any way to go about this?

LearnToday
  • 2,762
  • 9
  • 38
  • 67
  • Does this answer your question? https://stackoverflow.com/questions/29557374/how-to-use-condition-decorator-for-rest-view-classes – kamran890 Jul 29 '21 at 15:59
  • Doesn't seem to answer my question @kamran890. WSGIRequest won't contain the data i am looking for. will it? – LearnToday Jul 29 '21 at 16:30

0 Answers0