mirror of
https://github.com/AudebertAdrien/ft_transcendence.git
synced 2026-11-09 18:27:06 +01:00
Ca casse les couilles, tounroi veut pas s'afficher, I need chatgpt plus prenium extra !
This commit is contained in:
@@ -4,9 +4,7 @@ from django.urls import path, include
|
||||
from . import views
|
||||
from .views import player_list, tournoi_list, match_list
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from .views import match_list_json
|
||||
from .views import player_list_json
|
||||
|
||||
from .views import match_list_json, player_list_json, tournoi_list_json
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
@@ -20,4 +18,5 @@ urlpatterns = [
|
||||
path('tournois/', tournoi_list, name='tournoi_list'),
|
||||
path('api/match_list/', match_list_json, name='match_list_json'),
|
||||
path('api/player_list/', player_list_json, name='player_list_json'),
|
||||
path('api/tournoi_list/', tournoi_list_json, name='tournoi_list_json')
|
||||
]
|
||||
|
||||
@@ -114,6 +114,20 @@ def player_list_json(request):
|
||||
# Renvoie les données en JSON
|
||||
return JsonResponse(data)
|
||||
|
||||
def tournoi_list_json(request):
|
||||
# Récupère tous les joueurs
|
||||
tournois = Tournoi.objects.all()
|
||||
|
||||
# Crée un dictionnaire avec les informations des joueurs
|
||||
data = {
|
||||
'tournois': list(tournois.values(
|
||||
'id', 'name', 'nbr_player', 'date', 'winner'
|
||||
))
|
||||
}
|
||||
|
||||
# Renvoie les données en JSON
|
||||
return JsonResponse(data)
|
||||
|
||||
|
||||
####################### THEOUCHE PART ############################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user