Puts __all__ to the serializers

clubs
Laurent 2 years ago
parent 18bb49ea5a
commit 858dac4a12
  1. 43
      tournaments/serializers.py
  2. 38
      tournaments/templates/tournaments/test.html

@ -17,12 +17,12 @@ class UserSerializer(serializers.ModelSerializer):
class Meta:
club_id = serializers.PrimaryKeyRelatedField(queryset=Club.objects.all())
model = CustomUser
fields = ['id', 'username', 'password', 'umpire_code', 'clubs', 'phone', 'first_name', 'last_name', 'licence_id']
fields = '__all__' # ['id', 'username', 'password', 'umpire_code', 'clubs', 'phone', 'first_name', 'last_name', 'licence_id']
class ClubSerializer(serializers.ModelSerializer):
class Meta:
model = Club
fields = ['id', 'name', 'acronym', 'phone', 'code', 'federal_club_data', 'address', 'city', 'zip_code', 'latitude', 'longitude']
fields = '__all__' # ['id', 'name', 'acronym', 'phone', 'code', 'federal_club_data', 'address', 'city', 'zip_code', 'latitude', 'longitude']
class TournamentSerializer(serializers.ModelSerializer):
class Meta:
@ -30,62 +30,67 @@ class TournamentSerializer(serializers.ModelSerializer):
# event_id = serializers.PrimaryKeyRelatedField(queryset=Event.objects.all())
# creator_id = serializers.PrimaryKeyRelatedField(queryset=CustomUser.objects.all())
model = Tournament
fields = ['id', 'name', 'event', 'creator_id', 'start_date', 'end_date', 'creation_date',
'is_private', 'format', 'group_stage_format', 'round_format', 'loser_round_format', 'bracket_sort_mode',
'group_stage_count', 'rank_source_date', 'day_duration', 'team_count', 'team_sorting',
'federal_category', 'federal_level_category', 'federal_age_category', 'group_stage_court_count',
'seed_count', 'closed_registration_date', 'group_stage_additional_qualified', 'court_count', 'prioritize_club_members',
'qualified_per_group_stage', 'teams_per_group_stage']
fields = '__all__'
# ['id', 'name', 'event', 'creator_id', 'start_date', 'end_date', 'creation_date',
# 'is_private', 'format', 'group_stage_format', 'round_format', 'loser_round_format', 'bracket_sort_mode',
# 'group_stage_count', 'rank_source_date', 'day_duration', 'team_count', 'team_sorting',
# 'federal_category', 'federal_level_category', 'federal_age_category', 'group_stage_court_count',
# 'seed_count', 'closed_registration_date', 'group_stage_additional_qualified', 'court_count', 'prioritize_club_members',
# 'qualified_per_group_stage', 'teams_per_group_stage']
class EventSerializer(serializers.ModelSerializer):
class Meta:
# club_id = serializers.PrimaryKeyRelatedField(queryset=Club.objects.all())
club_id = serializers.PrimaryKeyRelatedField(queryset=Club.objects.all())
model = Event
fields = ['id', 'club_id', 'date', 'name', 'federal_tournament_data', 'court_count', 'tenup_id',
'group_stage_format', 'round_format', 'loser_round_format']
fields = '__all__'
# ['id', 'club_id', 'date', 'name', 'federal_tournament_data', 'court_count', 'tenup_id',
# 'group_stage_format', 'round_format', 'loser_round_format']
class RoundSerializer(serializers.ModelSerializer):
class Meta:
# tournament_id = serializers.PrimaryKeyRelatedField(queryset=Tournament.objects.all())
# loser_id = serializers.PrimaryKeyRelatedField(queryset=Round.objects.all())
model = Round
fields = ['id', 'index', 'tournament_id', 'loser', 'format']
fields = '__all__' #['id', 'index', 'tournament_id', 'loser', 'format']
class GroupStageSerializer(serializers.ModelSerializer):
class Meta:
# tournament_id = serializers.PrimaryKeyRelatedField(queryset=Tournament.objects.all())
model = GroupStage
fields = ['id', 'index', 'tournament_id', 'format']
fields = '__all__' # ['id', 'index', 'tournament_id', 'format']
class MatchSerializer(serializers.ModelSerializer):
class Meta:
# round_id = serializers.PrimaryKeyRelatedField(queryset=Round.objects.all())
# group_stage_id = serializers.PrimaryKeyRelatedField(queryset=GroupStage.objects.all())
model = Match
fields = ['id', 'round_id', 'group_stage_id', 'index', 'format', 'court', 'start_date', 'end_date',
'serving_team_id', 'winning_team_id', 'losing_team_id']
fields = '__all__'
# ['id', 'round_id', 'group_stage_id', 'index', 'format', 'court', 'start_date', 'end_date',
# 'serving_team_id', 'winning_team_id', 'losing_team_id']
class TeamScoreSerializer(serializers.ModelSerializer):
class Meta:
# match_id = serializers.PrimaryKeyRelatedField(queryset=Match.objects.all())
# player_registrations_ids = serializers.Man
model = TeamScore
fields = ['id', 'match_id', 'score', 'walk_out', 'lucky_loser', 'player_registrations']
fields = '__all__' # ['id', 'match_id', 'score', 'walk_out', 'lucky_loser', 'player_registrations']
class TeamRegistrationSerializer(serializers.ModelSerializer):
class Meta:
# match_id = serializers.PrimaryKeyRelatedField(queryset=Match.objects.all())
# group_stage_id = serializers.PrimaryKeyRelatedField(queryset=GroupStage.objects.all())
model = TeamRegistration
fields = ['id', 'group_stage_id', 'registration_date', 'call_date', 'bracket_position',
'group_stage_position', 'logo']
fields = '__all__'
# ['id', 'group_stage_id', 'registration_date', 'call_date', 'bracket_position',
# 'group_stage_position', 'logo']
class PlayerRegistrationSerializer(serializers.ModelSerializer):
class Meta:
# team_registration_id = serializers.PrimaryKeyRelatedField(queryset=TeamRegistration.objects.all())
# team_state_id = serializers.PrimaryKeyRelatedField(queryset=TeamState.objects.all())
model = PlayerRegistration
fields = ['id', 'team_registration_id', 'first_name', 'last_name', 'licence_id', 'rank', 'has_paid']
fields = '__all__'
# ['id', 'team_registration_id', 'first_name', 'last_name', 'licence_id', 'rank', 'has_paid']
class ChangePasswordSerializer(serializers.Serializer):
old_password = serializers.CharField(max_length=128, write_only=True, required=True)

@ -59,25 +59,25 @@
<div class="grid-x padding-bottom">
<div class="cell medium-6 large-6 topblock my-block">
<template x-for="(player, index) in players" >
<div x-data="{
openBubble: function(index){
let bubble = index % 2 ? true : false;
let html = ``;
if(bubble) html+= `<div class='bubble'>`;
return html;
}, closeBubble: function(index){
let bubble = index % 2 ? true : false;
let html = ``;
if(bubble) html += `</div>`;
return html;
},
}">
<div x-html="openBubble(index)"></div>
<span x-text="player.first_name"></span> <span x-text="player.last_name"></span>
<div x-html="closeBubble(index)"></div>
</div>
</template>
<template x-for="(player, index) in players" >
<div x-data="{
openBubble: function(index){
let bubble = index % 2 ? true : false;
let html = ``;
if(bubble) html+= `<div class='bubble'>`;
return html;
}, closeBubble: function(index){
let bubble = index % 2 ? true : false;
let html = ``;
if(bubble) html += `</div>`;
return html;
},
}">
<div x-html="openBubble(index)"></div>
<span x-text="player.first_name"></span> <span x-text="player.last_name"></span>
<div x-html="closeBubble(index)"></div>
</div>
</template>
<!-- <template x-for="(player, index) in players" >
<div x-data="{

Loading…
Cancel
Save