1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 02:06:52 +00:00

Fix video table

This commit is contained in:
Yohann D'ANELLO 2020-11-03 15:33:25 +01:00
parent aed9f457c3
commit 52763cb75a
2 changed files with 15 additions and 6 deletions

View File

@ -72,19 +72,17 @@ class ParticipationTable(tables.Table):
class VideoTable(tables.Table):
participationname = tables.LinkColumn(
participation_name = tables.LinkColumn(
'participation:participation_detail',
args=[tables.A("participation__pk")],
verbose_name=lambda: _("name").capitalize(),
accessor=tables.A("participation__team__name"),
)
def render_participationname(self, record):
return record.participation.team.name
class Meta:
attrs = {
'class': 'table table condensed table-striped',
}
model = Team
fields = ('participationname', 'link',)
fields = ('participation_name', 'link',)
template_name = 'django_tables2/bootstrap4.html'

View File

@ -4,7 +4,7 @@ from django.contrib.sites.models import Site
from django.core.management import call_command
from django.test import TestCase
from django.urls import reverse
from registration.models import StudentRegistration
from registration.models import CoachRegistration, StudentRegistration
from .models import Participation, Question, Team
@ -60,6 +60,14 @@ class TestStudentParticipation(TestCase):
grant_animath_access_videos=True,
)
self.coach = User.objects.create(
first_name="Coach",
last_name="Coach",
email="coach@example.com",
password="coach",
)
CoachRegistration.objects.create(user=self.coach)
def test_admin_pages(self):
"""
Load Django-admin pages.
@ -356,6 +364,9 @@ class TestStudentParticipation(TestCase):
self.user.registration.team = self.team
self.user.registration.save()
self.coach.registration.team = self.team
self.coach.registration.save()
response = self.client.get(reverse("participation:update_team", args=(self.team.pk,)))
self.assertEqual(response.status_code, 200)