Redirect to game_detail

The redirect works now. So if you click on a game,
 it wilk take you there

Signed-off-by: Pratyush Desai <pratyush.desai@liberta.casa>
This commit is contained in:
Pratyush Desai 2025-02-11 19:38:01 +05:30
parent 180900c752
commit fc6593329b
Signed by: pratyush
GPG Key ID: DBA5BB7505946FAD
4 changed files with 15 additions and 11 deletions

View File

@ -176,23 +176,26 @@
<body>
<div class="navbar">
<div class="left">
<div class="center">
<pre>
┬ ┌┬┐ ┬─┐ ┌─┐ ┬─┐ ┐─┐ ┬─┐
│ │ │─│ │ │─┤ └─┐ │─┤
┘─┘ └┴┘ │─┘ └─┘ ┘ │ ──┘ ┘ │
</pre>
</div>
<div class="navbar">
<div class="left">
<a href="{% url 'home' %}">Home</a>
<a href="{% url 'games' %}">Games</a>
<a href="#">Mods</a>
</div>
</div>
</div class="navbar>
<!-- <div class="right">
<div class="search-box">
<input type="text" placeholder="Search...">
</div>
<a href="#">Auth / Settings</a> -->
<div class="profile">Dp</div>
<!-- <div class="profile">Dp</div> -->
</div>
</div>
@ -202,10 +205,10 @@
<footer>
<a href="https://ozFrags.net">Other Communities</a>
<a href="#">Terms of Service</a>
<a href="#">License: AGPL</a>
<a href="#">Donate</a>
<a href="ircs://irc.casa/#gibcasa">Support</a>
<a href="https://liberta.casa/rules.html">Terms of Service</a>
<a href="#">License: AGPLish</a>
<a href="#">Contribute (WIP)</a>
<a href="https://liberta.casa/gamja/#gibcasa">Support</a>
</footer>
</body>

View File

@ -8,7 +8,7 @@
<div class="game-grid" style="display: flex; flex-wrap: wrap; gap: 10px;">
{% for game in games %}
<div class="game-box" style="width: 150px; text-align: center;">
<a href="{% url 'games' %}">
<a href="{% url 'game_detail' game.name %}">
<img src="{{ game.thumbnail.url }}" alt="{{ game.name }}" style="width: 100%; height: auto;">
<p>{{ game.name }}</p>
</a>

View File

@ -7,7 +7,7 @@ from . import views
urlpatterns = [
path('', views.home, name='home'),
path('games/', views.games, name='games'),
path('games/<str:game>/', views.game_detail, name='game_detail'),
path('games/<str:game_name>/', views.game_detail, name='game_detail'),
# path('active-servers/', views.active_servers_view, name='active-servers'),
# path('games/<str:game_name>/', views.game_servers_view, name='game-servers'),
]

View File

@ -11,5 +11,6 @@ def games(request):
return render(request, 'webpanel/games.html', {'games': games})
def game_detail(request, game_name):
game = get_object_or_404(Game, id=game_name)
print(f"Looking for game: {game_name}")
game = get_object_or_404(Game, name=game_name)
return render(request, 'webpanel/game_detail.html', {'game': game})