-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PersonListView to show all persons who are staff
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |