I am having problems to show the results of a query, the error that shows me is that it does not find the page (404)
I'm starting with django rest framework and maybe it's very obvious but I have not seen it.
It is that I returned serialized the result of a query where I pass the parameters by the url. (I accept other alternatives, in case I'm focusing badly)
Starting with something simple, such as indicating an agent code in the url and returning the sales of that agent.
urls.py
url(r'^ventas-agente-fechas/(?P<agenteId>)/$', views.VentasAgenteFechas.as_view()),
views.py
class VentasAgenteFechas(generics.ListAPIView):
serializer_class = VentaAgenteFechaSerializer
def get_queryset(self):
agente = self.request.QUERY_PARAMS.get('agenteId', None)
queryset = Venta.objects.all()
if agente is not None:
queryset = queryset.filter(Agente=agente)
return queryset
serializers.py
class VentaAgenteFechaSerializer(serializers.ModelSerializer):
class Meta:
model = Venta
fields = ('id', 'Agente', 'CdgContrato', 'Cliente', 'FechaVenta', 'Importe', 'PorcentajeComision', 'FormaPago')
If I access link , it tells me that the page does not exist.