Raz 8 months ago
commit 4cbb9f0ddc
  1. 2
      tournaments/admin.py
  2. 7
      tournaments/signals.py
  3. 6
      tournaments/views.py

@ -53,7 +53,7 @@ class TournamentAdmin(admin.ModelAdmin):
search_fields = ['id']
class TeamRegistrationAdmin(admin.ModelAdmin):
list_display = ['player_names', 'group_stage_position', 'name', 'tournament', 'registration_date']
list_display = ['player_names', 'group_stage', 'name', 'tournament', 'registration_date']
list_filter = [SimpleTournamentListFilter]
search_fields = ['id']

@ -6,7 +6,6 @@ from django.conf import settings
from tournaments.models.tournament import Tournament
from tournaments.models.unregistered_player import UnregisteredPlayer
from django.utils import timezone
from django.db.utils import IntegrityError
from .models import Club, FailedApiCall, CustomUser, Log, TeamRegistration, PlayerRegistration, UnregisteredTeam, UnregisteredPlayer, TeamSortingType
import requests
@ -16,12 +15,6 @@ from tournaments.models import PlayerDataSource
from shared.discord import send_discord_log_message, send_discord_failed_calls_message
from datetime import datetime
# @receiver(pre_save, sender=CustomUser)
# def username_check(instance, sender, **kwargs):
# """Ensure that username unique constraint is case insensitive"""
# if sender.objects.filter(username__iexact=instance.username.lower()):
# raise IntegrityError("Le nom d'utilisateur existe déjà")
def generate_unique_code():
characters = string.ascii_lowercase + string.digits
while True:

@ -357,9 +357,9 @@ def broadcast_json(request, tournament_id):
def tournament_matches_json(request, tournament_id):
tournament = get_object_or_404(Tournament, pk=tournament_id)
matches, group_stages = tournament.broadcasted_matches_and_group_stages()
live_matches = [match.live_match() for match in matches]
data = json.dumps(live_matches, default=vars)
live_matches_dicts = [match.live_match().to_dict() for match in matches]
data = json.dumps(live_matches_dicts, default=vars)
return HttpResponse(data, content_type='application/json')
def tournament_prog_json(request, tournament_id):
@ -372,7 +372,7 @@ def tournament_prog_json(request, tournament_id):
if match is None or isinstance(match, dict) and match.get('empty'):
live_matches.append({"empty": True})
else:
live_matches.append(match.live_match())
live_matches.append(match.live_match().to_dict())
data = json.dumps(live_matches, default=vars)
return HttpResponse(data, content_type='application/json')

Loading…
Cancel
Save