Add grid and list views for games with improved templates and routing
This commit is contained in:
parent
408514d0c2
commit
ebd3633356
4 changed files with 40 additions and 4 deletions
|
|
@ -11,7 +11,8 @@ urlpatterns = [
|
|||
path("debug/", views.debug_view, name="debug"),
|
||||
path("campaigns/", views.DropCampaignListView.as_view(), name="campaign_list"),
|
||||
path("campaigns/<str:pk>/", views.DropCampaignDetailView.as_view(), name="campaign_detail"),
|
||||
path("games/", views.GameListView.as_view(), name="game_list"),
|
||||
path("games/", views.GamesGridView.as_view(), name="game_list"),
|
||||
path("games/list/", views.GamesListView.as_view(), name="game_list_simple"),
|
||||
path("games/<str:pk>/", views.GameDetailView.as_view(), name="game_detail"),
|
||||
path("games/<str:game_id>/subscribe/", views.subscribe_game_notifications, name="subscribe_notifications"),
|
||||
path("organizations/", views.OrgListView.as_view(), name="org_list"),
|
||||
|
|
|
|||
|
|
@ -154,11 +154,11 @@ class DropCampaignDetailView(DetailView):
|
|||
return context
|
||||
|
||||
|
||||
class GameListView(ListView):
|
||||
class GamesGridView(ListView):
|
||||
"""List view for games grouped by organization."""
|
||||
|
||||
model = Game
|
||||
template_name = "twitch/game_list.html"
|
||||
template_name = "twitch/games_grid.html"
|
||||
context_object_name = "games"
|
||||
|
||||
def get_queryset(self) -> QuerySet[Game]:
|
||||
|
|
@ -500,3 +500,9 @@ def subscribe_org_notifications(request: HttpRequest, org_id: str) -> HttpRespon
|
|||
|
||||
messages.warning(request, "Only POST is available for this view.")
|
||||
return redirect("twitch:organization_detail", pk=organization.id)
|
||||
|
||||
|
||||
class GamesListView(GamesGridView):
|
||||
"""List view for games in simple list format."""
|
||||
|
||||
template_name = "twitch/games_list.html"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue