My url pattern :
path('business/average/turnover/<str:start_date>/<str:end_date>/', views.AverageTurnover.as_view())
when go to the url it shows something like this :
http://127.0.0.1:8000/business/average/turnover/2019-01-1/2019-12-12/
but i want it to be like this :
http://127.0.0.1:8000/business?start_date=adfadf&end_date=xsdfa
How to do this.
Note: I have no view function is rendering this url but when i am directly hitting this url then it goes to views like this.
views.py
class AverageTurnover(APIView):
'''Average Turn Over'''
def get(self, request, start_date, end_date):
avg_turnover = BusinessShareInfo.objects.filter(Date__range=(start_date, end_date)).aggregate(Avg('Turnover'))
return Response(avg_turnover)