mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-23 01:57:03 +03:00
Merge pull request #2062 from pydanny/remove-user-lists
Remove user list view
This commit is contained in:
commit
698e71a2de
|
@ -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"
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user