title: How to export a PDF from an endpoint in Django Rest Framework
body: <p>I'm currently setting up a <strong>GET</strong> request from my endpoint to export a PDF file based on the filters(<strong>django_filters</strong>) on my ModelViewSet and the PDF's design will based on the template_path provided. And I'm fairly new on using DRF, so I'm new to some things.</p>
  
  <p>I've tried using <strong>easy_pdf</strong> for my ModelViewSet, but it doesn't show on the endpoint's <strong>GET</strong> request. And also no error was provided in the logs, I assume I'm doing something really wrong on this.</p>
  
  <p>This is my Filter</p>
  
  <pre><code>class CarrierFilter(django_filters.FilterSet):
      date_app_rec__gte = DateFilter(field_name='date_app_rec', lookup_expr='gte')
      date_app_rec__lte = DateFilter(field_name='date_app_rec', lookup_expr='lte')
      date_sample_rec__gte = DateFilter(field_name='date_sample_rec', lookup_expr='gte')
      date_sample_rec__lte = DateFilter(field_name='date_sample_rec', lookup_expr='lte')
      date_of_qca__gte = DateFilter(field_name='date_of_qca', lookup_expr='gte')
      date_of_qca__lte = DateFilter(field_name='date_of_qca', lookup_expr='lte')
      date_created__gte = DateFilter(field_name='date_created', lookup_expr='gte')
      date_created__lte = DateFilter(field_name='date_created', lookup_expr='lte')
      patient_name = CharFilter(field_name='patient_name', lookup_expr='icontains')
  
      class Meta:
          model = Carrier
          fields = ('date_app_rec__gte', 'date_app_rec__lte', 
                  'date_sample_rec__gte', 'date_sample_rec__lte',
                    'date_of_qca__gte', 'date_of_qca__lte',
                    'date_created__gte', 'date_created__lte',
                    'patient_name',)
  </code></pre>
  
  <p>And this is my ModelViewSet</p>
  
  <pre><code>class CarrierViewSet(XLSXFileMixin, PDFTemplateResponseMixin, ModelViewSet):
      serializer_class = CarrierSerializer
      permission_classes = (IsAuthenticated,)
      parser_classes = (MultiPartParser,)
      filename = 'carrier-reports.xlsx'
      pdf_filename = 'carrier-report.pdf'
      filter_class = (CarrierFilter)
      filterset_fields = ('patient_name', 'promo_code')
      search_fields = ('patient_name', 'promo_code', 'insurance_verified_tsg_verification')
  
      def get_queryset(self):
          user = self.request.user
          position = self.request.user.position
          if position == 'Manager':
              queryset = Carrier.objects.filter(manager__name=user)
          else:
              queryset = Carrier.objects.filter(agent__name=user)
          return queryset
  
      def get(self, request, format=None):
          carrier = Carrier.objects.all()
          template_path = 'carrier/carrier_print.html'
          response = HttpResponse(content_type='application/pdf')
          response['Content-Disposition'] = 'attachment; filename="carrier-report.pdf"'
  
          html = render_to_string(template_path, {'carrier': carrier})
          print(html)
  
          pisaStatus = pisa.CreatePDF(html, dest=response)
  
          return response
  </code></pre>
  
  <p>What I want to do is that the pdf should be in the <strong>GET</strong> request of that endpoint, same scenario as the drf_renderer_xlsx when using the xlsx from the <strong>GET</strong>. Or is there another way around on doing this?</p>