From 1064fa42f9b2df360909ce281a9a265efd127551 Mon Sep 17 00:00:00 2001 From: Steve Colburn Date: Mon, 1 Jul 2019 18:40:23 -0400 Subject: [PATCH 1/2] Addressing Issue #20 Duplicated GameTable into GameTable2 and removed the tournament_code from displaying from the page output. Tourney page changed to reflect new call. --- agagd/agagd_core/tables.py | 26 +++++++++++++++++++++++++ agagd/templates/agagd_core/tourney.html | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/agagd/agagd_core/tables.py b/agagd/agagd_core/tables.py index 0ae805f2..7b4d9c7a 100644 --- a/agagd/agagd_core/tables.py +++ b/agagd/agagd_core/tables.py @@ -13,6 +13,7 @@ def render(self, value, record, bound_column): self.attrs['td'] = {'class': 'foo'} return tables.LinkColumn.render(self, value, record, bound_column) +#Standard gameTable display as is on agagd.usgo.org and most pages class GameTable(tables.Table): pin_player_1 = WinnerColumn('W', viewname='agagd_core.views.member_detail', @@ -35,6 +36,31 @@ class Meta: "pin_player_2", 'handicap', 'komi', 'tournament_code') sequence = fields +#Modified gaeTable to remove duplicate tournament listing displayed on the page, GitHubIssue#20 +class GameTable2(tables.Table): + pin_player_1 = WinnerColumn('W', + viewname='agagd_core.views.member_detail', + verbose_name="white player", + kwargs={"member_id":tables.A('pin_player_1.member_id')}) + pin_player_2 = WinnerColumn('B', + 'agagd_core.views.member_detail', + verbose_name="black player", + kwargs={"member_id":tables.A('pin_player_2.member_id')}) + tournament_code = tables.LinkColumn( + verbose_name="Tournament", + viewname='agagd_core.views.tournament_detail', + kwargs={'tourn_code':tables.A('tournament_code.tournament_code')},) + + class Meta: + model = Game + # add class="paleblue" to tag + attrs = {"class": "paleblue"} + fields = ("game_date", "round", "pin_player_1", + "pin_player_2", 'handicap', 'komi') + sequence = fields + + + class OpponentTable(tables.Table): def __init__(self, qs, p1, *args, **kwargs): self.this_player = p1 diff --git a/agagd/templates/agagd_core/tourney.html b/agagd/templates/agagd_core/tourney.html index 99dc0830..89361915 100644 --- a/agagd/templates/agagd_core/tourney.html +++ b/agagd/templates/agagd_core/tourney.html @@ -18,6 +18,6 @@

Recreated Wall List

 {{ tournament.wall_list }} 

Games

- {% render_table game_table %} + {% render_table game_table2 %} {% endblock %} From 4d4a13bd88204531048f1f19920de3d2a5299ca9 Mon Sep 17 00:00:00 2001 From: Michael Hiiva Date: Mon, 15 Jul 2019 14:18:53 -0700 Subject: [PATCH 2/2] Added game_table2 to tournamet_detail. --- agagd/agagd_core/tables.py | 5 ----- agagd/agagd_core/views/core.py | 8 ++++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/agagd/agagd_core/tables.py b/agagd/agagd_core/tables.py index 7b4d9c7a..dd9fb0c2 100644 --- a/agagd/agagd_core/tables.py +++ b/agagd/agagd_core/tables.py @@ -46,11 +46,6 @@ class GameTable2(tables.Table): 'agagd_core.views.member_detail', verbose_name="black player", kwargs={"member_id":tables.A('pin_player_2.member_id')}) - tournament_code = tables.LinkColumn( - verbose_name="Tournament", - viewname='agagd_core.views.tournament_detail', - kwargs={'tourn_code':tables.A('tournament_code.tournament_code')},) - class Meta: model = Game # add class="paleblue" to
tag diff --git a/agagd/agagd_core/views/core.py b/agagd/agagd_core/views/core.py index 8ddc5501..aa6759c6 100644 --- a/agagd/agagd_core/views/core.py +++ b/agagd/agagd_core/views/core.py @@ -1,6 +1,6 @@ from agagd_core.json_response import JsonResponse from agagd_core.models import Game, Member, Tournament, Chapters, Country -from agagd_core.tables import GameTable, MemberTable, TournamentTable, OpponentTable, TournamentPlayedTable +from agagd_core.tables import GameTable, GameTable2, MemberTable, TournamentTable, OpponentTable, TournamentPlayedTable from datetime import datetime, timedelta, date from django.core import exceptions from django.core.urlresolvers import reverse @@ -163,11 +163,11 @@ def member_vs(request, member_id, other_id): def tournament_detail(request, tourn_code): tourney = Tournament.objects.get(pk=tourn_code) - game_table = GameTable(tourney.games_in_tourney.all()) - RequestConfig(request, paginate={'per_page': 20}).configure(game_table) + game_table2 = GameTable2(tourney.games_in_tourney.all()) + RequestConfig(request, paginate={'per_page': 20}).configure(game_table2) return render(request, 'agagd_core/tourney.html', { - 'game_table': game_table, + 'game_table2': game_table2, 'tournament': tourney, })