fix regression on event api

clubs
Laurent 2 years ago
parent 8f692793a8
commit 18bb49ea5a
  1. 3
      tournaments/serializers.py
  2. 40
      tournaments/templates/tournaments/test.html

@ -41,7 +41,8 @@ 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 = '__all__' fields = ['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 RoundSerializer(serializers.ModelSerializer):
class Meta: class Meta:

@ -59,6 +59,26 @@
<div class="grid-x padding-bottom"> <div class="grid-x padding-bottom">
<div class="cell medium-6 large-6 topblock my-block"> <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" > <!-- <template x-for="(player, index) in players" >
<div x-data="{ <div x-data="{
addOpeningTagIfNecessary(index) { addOpeningTagIfNecessary(index) {
@ -75,10 +95,24 @@
</div> </div>
</template> --> </template> -->
<template x-for="(player, index) in players" > <!-- <template x-for="(player, index) in players" >
<div x-data="{
doHTML: function(index){
let bubble = index % 2 ? true : false;
let html = ``;
if(bubble) html+= `<div class='bubble'>`;
html += `<span x-text='player.first_name'></span> <span x- text='player.last_name'></span>`;
if(bubble) html += `</div>`;
return html;
},
}" x-html="doHTML(index)">
</div>
</template> -->
<!-- <template x-for="(player, index) in players" >
<div x-data="{ <div x-data="{
doHTML: function(index) { doHTML: function(index) {
let bubble = (index % 2 === 0) ? true : false; let bubble = index % 2 ? true : false;
let html = ``; let html = ``;
if(bubble) html+= `<div class='bubble'>`; if(bubble) html+= `<div class='bubble'>`;
html = `<span x-text='player.first_name'></span> <span x-text='player.last_name'></span>`; html = `<span x-text='player.first_name'></span> <span x-text='player.last_name'></span>`;
@ -87,7 +121,7 @@
}, },
}" x-html="doHTML(index)"> }" x-html="doHTML(index)">
</div> </div>
</template> </template> -->
<!-- <template x-for="(player, index) in players" > <!-- <template x-for="(player, index) in players" >
<div x-data="{ <div x-data="{

Loading…
Cancel
Save