drf-chunked-upload icon indicating copy to clipboard operation
drf-chunked-upload copied to clipboard

No Reverse Match for `chunkedupload-detail`

Open charliemday opened this issue 11 months ago • 3 comments

Using the basic setup:

from drf_chunked_upload.views import ChunkedUploadView

class MyChunkView(ChunkedUploadView):
    pass

I'm hitting a NoReverseMatch error. This seems to be cause on the serializer.py where it tries to to find a chunkedupload-detail URL and doesn't seem to find the one in tests.py (assuming this is the reverse target). I've had to get around it just creating my own url and view e.g.

urls.py

path(
    "uploadchuncks/<uuid:pk>/",
    ChunkedUploadDetailView.as_view(),
    name="chunkedupload-detail",
),

views.py

class ChunkedUploadDetailView(RetrieveAPIView):
    queryset = ChunkedUpload.objects.all()
    serializer_class = ChunkedUploadSerializer

Curious if anyone else is experiencing this?

Packages: Django==3.2.16

charliemday avatar Mar 13 '24 15:03 charliemday

Any updates? I am trying the package with a basic setup like you. But got the same error. Could you find any solution?

RDonii avatar Mar 17 '24 05:03 RDonii

That is correct, you need a URL with the name chunkedupload-detail to not get the NoReverseMatch exception. The path should actually map to the same MyChunkView in your example, and you shoudn't need to create your own based off of RetrieveAPIView. See here for an example: https://github.com/shipperstack/shipper/blob/master/server/api/urls.py and https://github.com/shipperstack/shipper/blob/master/server/api/views/shippy.py

ericswpark avatar Mar 17 '24 17:03 ericswpark

Any updates? I am trying the package with a basic setup like you. But got the same error. Could you find any solution?

The only solution I had was to have a separate path e.g.

path(
    "uploadchuncks/<uuid:pk>/",
    ChunkedUploadDetailView.as_view(),
    name="chunkedupload-detail",
)

The reason it could be not picking it up is because Django is only looking for paths in your project (i.e. not third party packages) so perhaps a solution for this project is to export the tests.py urls (e.g. https://github.com/jkeifer/drf-chunked-upload/blob/main/tests/urls.py) to allow it to be appended onto your urlpatterns in your base urls.py?

charliemday avatar Mar 18 '24 16:03 charliemday