Skip to content

Commit

Permalink
Added PersonListView to show all persons who are staff
Browse files Browse the repository at this point in the history
  • Loading branch information
Fer-Bar committed May 26, 2024
1 parent 0ef9b2a commit d5a6ac1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions people/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.urls import path

from people.views import PersonListView

app_name = "people"
urlpatterns = [
path("members/", PersonListView.as_view(), name="member-list"),
]
12 changes: 12 additions & 0 deletions people/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.utils.decorators import method_decorator
from django.views.decorators.http import require_http_methods
from django.views.generic import ListView

from people.models import Person


@method_decorator(require_http_methods(["GET"]), name='dispatch')
class PersonListView(ListView):
queryset = Person.objects.filter(user__is_staff=True)
context_object_name = "people"
template_name = "people/members.html"

0 comments on commit d5a6ac1

Please sign in to comment.