Merge pull request #2062 from pydanny/remove-user-lists

Remove user list view
This commit is contained in:
Bruno Alla 2019-05-18 13:03:50 +01:00 committed by GitHub
commit 698e71a2de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 18 deletions

View File

@ -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"

View File

@ -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("<str:username>/", view=user_detail_view, name="detail"),

View File

@ -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