rename TeamCall into TeamSummon

clubs
Laurent 2 years ago
parent f19d452718
commit 88ca6f4bc4
  1. 2
      tournaments/models/__init__.py
  2. 12
      tournaments/models/tournament.py
  3. 3
      tournaments/serializers.py
  4. 8
      tournaments/templates/tournaments/summon_row.html
  5. 2
      tournaments/templates/tournaments/summons.html
  6. 2
      tournaments/urls.py
  7. 8
      tournaments/views.py

@ -2,7 +2,7 @@ from .club import Club
from .custom_user import CustomUser from .custom_user import CustomUser
from .enums import FederalCategory, FederalLevelCategory, FederalAgeCategory, FederalMatchCategory from .enums import FederalCategory, FederalLevelCategory, FederalAgeCategory, FederalMatchCategory
from .event import Event from .event import Event
from .tournament import Tournament, TeamCall from .tournament import Tournament, TeamSummon
from .group_stage import GroupStage from .group_stage import GroupStage
from .round import Round from .round import Round
from .match import Match, LiveMatch from .match import Match, LiveMatch

@ -47,19 +47,19 @@ class Tournament(models.Model):
def formatted_start_date(self): def formatted_start_date(self):
return self.start_date.strftime("%d/%m/%y") return self.start_date.strftime("%d/%m/%y")
def team_calls(self): def team_summons(self):
team_calls = [] summons = []
for team_registration in self.teamregistration_set.all(): for team_registration in self.teamregistration_set.all():
call_date = team_registration.call_date call_date = team_registration.call_date
if call_date: if call_date:
names = team_registration.team_names() names = team_registration.team_names()
stage = team_registration.next_stage() stage = team_registration.next_stage()
weight = team_registration.weight() weight = team_registration.weight()
team_call = TeamCall(names, call_date, weight, stage, team_registration.logo) summon = TeamSummon(names, call_date, weight, stage, team_registration.logo)
team_calls.append(team_call) summons.append(summon)
return team_calls return summons
def live_matches(self): def live_matches(self):
matches = [] matches = []
@ -81,7 +81,7 @@ class Tournament(models.Model):
# # Convert dictionary to JSON # # Convert dictionary to JSON
# return json.dumps(dict) # return json.dumps(dict)
class TeamCall: class TeamSummon:
def __init__(self, names, date, weight, stage, image): def __init__(self, names, date, weight, stage, image):
self.names = [] self.names = []
self.names = names self.names = names

@ -41,8 +41,7 @@ class EventSerializer(serializers.ModelSerializer):
class Meta: class Meta:
# club_id = serializers.PrimaryKeyRelatedField(queryset=Club.objects.all()) # club_id = serializers.PrimaryKeyRelatedField(queryset=Club.objects.all())
model = Event model = Event
fields = ['id', 'club_id', 'date', 'name', 'federal_tournament_data', 'court_count', 'tenup_id', fields = '__all__'
'group_stage_format', 'round_format', 'loser_round_format']
class RoundSerializer(serializers.ModelSerializer): class RoundSerializer(serializers.ModelSerializer):
class Meta: class Meta:

@ -6,12 +6,12 @@
</div> </div>
<!-- <img src="{% static 'tournaments/images/{{ team_call.image }}' %}" class="team_image horizontal-margin"> --> <!-- <img src="{% static 'tournaments/images/{{ team_call.image }}' %}" class="team_image horizontal-margin"> -->
<div class="table-cell table-cell-large tight"> <div class="table-cell table-cell-large tight">
{% for name in team_call.names %} {% for name in summon.names %}
<div>{{ name }}</div> <div>{{ name }}</div>
{% endfor %} {% endfor %}
</div> </div>
<div class="table-cell">{{ team_call.weight }}</div> <div class="table-cell">{{ summon.weight }}</div>
<div class="table-cell large">{{ team_call.date|date:'H:i' }}</div> <div class="table-cell large">{{ summon.date|date:'H:i' }}</div>
<div class="table-cell"><div class="mybox center">{{ team_call.stage }}</div></div> <div class="table-cell"><div class="mybox center">{{ summon.stage }}</div></div>
</div> </div>

@ -43,7 +43,7 @@
<div class="cell medium-6 large-6 topblock my-block"> <div class="cell medium-6 large-6 topblock my-block">
<div class="bubble"> <div class="bubble">
{% for team_call in team_calls %} {% for summon in team_summons %}
{% include 'tournaments/summon_row.html' %} {% include 'tournaments/summon_row.html' %}

@ -5,6 +5,6 @@ from . import views
urlpatterns = [ urlpatterns = [
path("", views.index, name="index"), path("", views.index, name="index"),
path('tournament/<str:tournament_id>/', views.tournament, name='tournament'), path('tournament/<str:tournament_id>/', views.tournament, name='tournament'),
path('tournament/<str:tournament_id>/planning/', views.tournament_planning, name='tournament-planning'), path('tournament/<str:tournament_id>/summons/', views.tournament_summons, name='tournament-summons'),
path('tournament/<str:tournament_id>/json/', views.tournament_json, name='tournament-json'), path('tournament/<str:tournament_id>/json/', views.tournament_json, name='tournament-json'),
] ]

@ -2,7 +2,7 @@ from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse from django.http import HttpResponse
from .serializers import ClubSerializer, TournamentSerializer, UserSerializer, ChangePasswordSerializer, EventSerializer, RoundSerializer, GroupStageSerializer, MatchSerializer, TeamScoreSerializer, TeamRegistrationSerializer, PlayerRegistrationSerializer, LiveMatchSerializer from .serializers import ClubSerializer, TournamentSerializer, UserSerializer, ChangePasswordSerializer, EventSerializer, RoundSerializer, GroupStageSerializer, MatchSerializer, TeamScoreSerializer, TeamRegistrationSerializer, PlayerRegistrationSerializer, LiveMatchSerializer
from .models import Club, Tournament, CustomUser, Event, Round, GroupStage, Match, TeamScore, TeamRegistration, PlayerRegistration from .models import Club, Tournament, CustomUser, Event, Round, GroupStage, Match, TeamScore, TeamRegistration, PlayerRegistration
from .models import TeamCall from .models import TeamSummon
from rest_framework import viewsets, permissions from rest_framework import viewsets, permissions
from rest_framework.authtoken.models import Token from rest_framework.authtoken.models import Token
@ -65,14 +65,14 @@ def tournament(request, tournament_id):
# } # }
# return HttpResponse(template.render(context, request)) # return HttpResponse(template.render(context, request))
def tournament_planning(request, tournament_id): def tournament_summons(request, tournament_id):
tournament = get_object_or_404(Tournament, pk=tournament_id) tournament = get_object_or_404(Tournament, pk=tournament_id)
team_calls = tournament.team_calls() team_summons = tournament.team_summons()
template = loader.get_template('tournaments/summons.html') template = loader.get_template('tournaments/summons.html')
context = { context = {
'team_calls': team_calls, 'team_summons': team_summons,
} }
return HttpResponse(template.render(context, request)) return HttpResponse(template.render(context, request))

Loading…
Cancel
Save