mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-02-06 11:33:00 +00:00
Fix video table
This commit is contained in:
parent
aed9f457c3
commit
52763cb75a
@ -72,19 +72,17 @@ class ParticipationTable(tables.Table):
|
|||||||
|
|
||||||
|
|
||||||
class VideoTable(tables.Table):
|
class VideoTable(tables.Table):
|
||||||
participationname = tables.LinkColumn(
|
participation_name = tables.LinkColumn(
|
||||||
'participation:participation_detail',
|
'participation:participation_detail',
|
||||||
args=[tables.A("participation__pk")],
|
args=[tables.A("participation__pk")],
|
||||||
verbose_name=lambda: _("name").capitalize(),
|
verbose_name=lambda: _("name").capitalize(),
|
||||||
|
accessor=tables.A("participation__team__name"),
|
||||||
)
|
)
|
||||||
|
|
||||||
def render_participationname(self, record):
|
|
||||||
return record.participation.team.name
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
attrs = {
|
attrs = {
|
||||||
'class': 'table table condensed table-striped',
|
'class': 'table table condensed table-striped',
|
||||||
}
|
}
|
||||||
model = Team
|
model = Team
|
||||||
fields = ('participationname', 'link',)
|
fields = ('participation_name', 'link',)
|
||||||
template_name = 'django_tables2/bootstrap4.html'
|
template_name = 'django_tables2/bootstrap4.html'
|
||||||
|
@ -4,7 +4,7 @@ from django.contrib.sites.models import Site
|
|||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from registration.models import StudentRegistration
|
from registration.models import CoachRegistration, StudentRegistration
|
||||||
|
|
||||||
from .models import Participation, Question, Team
|
from .models import Participation, Question, Team
|
||||||
|
|
||||||
@ -60,6 +60,14 @@ class TestStudentParticipation(TestCase):
|
|||||||
grant_animath_access_videos=True,
|
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):
|
def test_admin_pages(self):
|
||||||
"""
|
"""
|
||||||
Load Django-admin pages.
|
Load Django-admin pages.
|
||||||
@ -356,6 +364,9 @@ class TestStudentParticipation(TestCase):
|
|||||||
self.user.registration.team = self.team
|
self.user.registration.team = self.team
|
||||||
self.user.registration.save()
|
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,)))
|
response = self.client.get(reverse("participation:update_team", args=(self.team.pk,)))
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user