0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Do not use super().get_urlpatterns in ModelViewSet and SnippetViewSet

In ModelViewSet, this doesn't do anything as the base ViewSet class
returns an empty list.

In SnippetViewSet, this causes the ModelViewSet's urlpatterns to be
carried over, resulting in duplicate URLs that we do not want.
This commit is contained in:
Sage Abdullah 2023-09-15 10:29:17 +01:00
parent bc09537136
commit 47af24381e
No known key found for this signature in database
GPG Key ID: EB1A33CC51CC0217
2 changed files with 2 additions and 2 deletions

View File

@ -409,7 +409,7 @@ class ModelViewSet(ViewSet):
ReferenceIndex.register_model(self.model)
def get_urlpatterns(self):
return super().get_urlpatterns() + [
return [
path("", self.index_view, name="index"),
path("results/", self.index_results_view, name="index_results"),
path("new/", self.add_view, name="add"),

View File

@ -1255,7 +1255,7 @@ class SnippetViewSet(ModelViewSet):
)
def get_urlpatterns(self):
urlpatterns = super().get_urlpatterns() + [
urlpatterns = [
path("", self.index_view, name="list"),
path("results/", self.index_results_view, name="list_results"),
path("add/", self.add_view, name="add"),