mirror of
https://github.com/bratusev07/skb-market.git
synced 2026-12-05 05:09:44 +00:00
feat: update game models and configure PostgreSQL
This commit is contained in:
1 parent
a2cccbda59
commit
196d1e2ed7
14 files changed
+520
-8
No files matched your search
+31
-2
@@ -1,3 +1,32 @@
|
||||
from django.shortcuts import render
|
||||
from django.views.generic import ListView, DetailView
|
||||
|
||||
# Create your views here.
|
||||
from .models import Game
|
||||
|
||||
|
||||
class GameListView(ListView):
|
||||
"""Список опубликованных Unity-приложений."""
|
||||
|
||||
model = Game
|
||||
template_name = "games/game_list.html"
|
||||
context_object_name = "games"
|
||||
paginate_by = 12
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = Game.objects.filter(status=Game.STATUS_PUBLISHED)
|
||||
|
||||
query = self.request.GET.get("q")
|
||||
if query:
|
||||
queryset = queryset.filter(title__icontains=query)
|
||||
|
||||
return queryset
|
||||
|
||||
|
||||
class GameDetailView(DetailView):
|
||||
"""Детальная страница опубликованного Unity-приложения."""
|
||||
|
||||
model = Game
|
||||
template_name = "games/game_detail.html"
|
||||
context_object_name = "game"
|
||||
|
||||
def get_queryset(self):
|
||||
return Game.objects.filter(status=Game.STATUS_PUBLISHED)
|
||||
Reference in new issue
Block a user