0

I have a simple django get view:

@api_view(["GET"])
@permission_classes([IsAuthenticated])
def test_endpoint(request):
    print(request)
    print(request.GET)

The result of this -

<rest_framework.request.Request: GET '/api/test_endpoint?start=1969-12-31T19:00:00+05:00&end=2023-01-16T21:22:52-05:00'>

<QueryDict: {'start': ['1969-12-31T19:00:00 05:00'], 'end': ['2023-01-16T21:22:52-05:00']}>

If you notice start for some reason is cleansing out the + in the datetime. Thus causing an incorrectly formatted datetime object. I have no interest in changing my formatting, but rather fixing why django rest framework is removing the +. You can clearly see in the actual GET request that the + is properly in the string.

Any ideas on how to fix this so start value would be '1969-12-31T19:00:00+05:00' instead of '1969-12-31T19:00:00 05:00' without "fixing" it after the fact? (I want the request.GET object to be correct, I don't want to fix the values after retrieving them from request.GET)

user3533755
  • 111
  • 2
  • 12

0 Answers0