From 872204527f39386d687edf1e8ceffea56f76d211 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 17 May 2019 22:33:30 +0100 Subject: [PATCH] Remove user list view --- .../users/tests/test_urls.py | 5 ----- .../{{cookiecutter.project_slug}}/users/urls.py | 2 -- .../{{cookiecutter.project_slug}}/users/views.py | 12 +----------- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py index 20bd3dba..c6361920 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py @@ -13,11 +13,6 @@ def test_detail(user: settings.AUTH_USER_MODEL): assert resolve(f"/users/{user.username}/").view_name == "users:detail" -def test_list(): - assert reverse("users:list") == "/users/" - assert resolve("/users/").view_name == "users:list" - - def test_update(): assert reverse("users:update") == "/users/~update/" assert resolve("/users/~update/").view_name == "users:update" diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py index 2502a0c0..eff24dd0 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/urls.py @@ -1,7 +1,6 @@ from django.urls import path from {{ cookiecutter.project_slug }}.users.views import ( - user_list_view, user_redirect_view, user_update_view, user_detail_view, @@ -9,7 +8,6 @@ from {{ cookiecutter.project_slug }}.users.views import ( app_name = "users" urlpatterns = [ - path("", view=user_list_view, name="list"), path("~redirect/", view=user_redirect_view, name="redirect"), path("~update/", view=user_update_view, name="update"), path("/", view=user_detail_view, name="detail"), diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py index 35e26e94..a2442741 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py @@ -1,7 +1,7 @@ from django.contrib.auth import get_user_model from django.contrib.auth.mixins import LoginRequiredMixin from django.urls import reverse -from django.views.generic import DetailView, ListView, RedirectView, UpdateView +from django.views.generic import DetailView, RedirectView, UpdateView User = get_user_model() @@ -16,16 +16,6 @@ class UserDetailView(LoginRequiredMixin, DetailView): user_detail_view = UserDetailView.as_view() -class UserListView(LoginRequiredMixin, ListView): - - model = User - slug_field = "username" - slug_url_kwarg = "username" - - -user_list_view = UserListView.as_view() - - class UserUpdateView(LoginRequiredMixin, UpdateView): model = User