mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 16:22:22 +00:00
Replace pool name by its short name in severous views
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
3e24e10780
commit
bacdd5cfcf
@ -135,7 +135,7 @@ class PassageAdmin(admin.ModelAdmin):
|
|||||||
|
|
||||||
@admin.display(description=_("pool"), ordering='pool__letter')
|
@admin.display(description=_("pool"), ordering='pool__letter')
|
||||||
def pool_abbr(self, record):
|
def pool_abbr(self, record):
|
||||||
return f"{record.pool.get_letter_display()}{record.pool.round}"
|
return f"{record.pool.short_name}"
|
||||||
|
|
||||||
@admin.display(description=_("tournament"), ordering='pool__tournament__name')
|
@admin.display(description=_("tournament"), ordering='pool__tournament__name')
|
||||||
def tournament(self, record: Passage):
|
def tournament(self, record: Passage):
|
||||||
@ -154,7 +154,7 @@ class NoteAdmin(admin.ModelAdmin):
|
|||||||
|
|
||||||
@admin.display(description=_("pool"))
|
@admin.display(description=_("pool"))
|
||||||
def pool(self, record):
|
def pool(self, record):
|
||||||
return record.passage.pool.get_letter_display()
|
return record.passage.pool.short_name
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Solution)
|
@admin.register(Solution)
|
||||||
|
@ -1030,7 +1030,7 @@ class SolutionsDownloadView(VolunteerMixin, View):
|
|||||||
|
|
||||||
def prefix(s: Solution | Synthesis) -> str:
|
def prefix(s: Solution | Synthesis) -> str:
|
||||||
pool = s.pool if is_solution else s.passage.pool
|
pool = s.pool if is_solution else s.passage.pool
|
||||||
p = f"Poule {pool.get_letter_display()}{pool.round}/"
|
p = f"Poule {pool.short_name}/"
|
||||||
if not is_solution:
|
if not is_solution:
|
||||||
p += f"Passage {s.passage.position}/"
|
p += f"Passage {s.passage.position}/"
|
||||||
return p
|
return p
|
||||||
@ -1051,7 +1051,7 @@ class SolutionsDownloadView(VolunteerMixin, View):
|
|||||||
syntheses = Synthesis.objects.filter(passage__pool=pool).all()
|
syntheses = Synthesis.objects.filter(passage__pool=pool).all()
|
||||||
filename = _("Solutions for pool {pool} of tournament {tournament}.zip") \
|
filename = _("Solutions for pool {pool} of tournament {tournament}.zip") \
|
||||||
if is_solution else _("Syntheses for pool {pool} of tournament {tournament}.zip")
|
if is_solution else _("Syntheses for pool {pool} of tournament {tournament}.zip")
|
||||||
filename = filename.format(pool=pool.get_letter_display() + str(pool.round),
|
filename = filename.format(pool=pool.short_name,
|
||||||
tournament=pool.tournament.name)
|
tournament=pool.tournament.name)
|
||||||
|
|
||||||
def prefix(s: Solution | Synthesis) -> str:
|
def prefix(s: Solution | Synthesis) -> str:
|
||||||
@ -1093,7 +1093,7 @@ class PoolJuryView(VolunteerMixin, FormView, DetailView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['title'] = _("Jury of pool {pool} for {tournament} with teams {teams}") \
|
context['title'] = _("Jury of pool {pool} for {tournament} with teams {teams}") \
|
||||||
.format(pool=f"{self.object.get_letter_display()}{self.object.round}",
|
.format(pool=f"{self.object.short_name}",
|
||||||
tournament=self.object.tournament.name,
|
tournament=self.object.tournament.name,
|
||||||
teams=", ".join(participation.team.trigram for participation in self.object.participations.all()))
|
teams=", ".join(participation.team.trigram for participation in self.object.participations.all()))
|
||||||
return context
|
return context
|
||||||
@ -1453,7 +1453,7 @@ class PoolNotesTemplateView(VolunteerMixin, DetailView):
|
|||||||
col_style.addElement(TableColumnProperties(columnwidth="2.6cm", breakbefore="auto"))
|
col_style.addElement(TableColumnProperties(columnwidth="2.6cm", breakbefore="auto"))
|
||||||
doc.automaticstyles.addElement(col_style)
|
doc.automaticstyles.addElement(col_style)
|
||||||
|
|
||||||
table = Table(name=f"Poule {self.object.get_letter_display()}{self.object.round}")
|
table = Table(name=f"Poule {self.object.short_name}")
|
||||||
doc.spreadsheet.addElement(table)
|
doc.spreadsheet.addElement(table)
|
||||||
|
|
||||||
table.addElement(TableColumn(stylename=first_col_style))
|
table.addElement(TableColumn(stylename=first_col_style))
|
||||||
@ -1736,7 +1736,7 @@ class PoolNotesTemplateView(VolunteerMixin, DetailView):
|
|||||||
return FileResponse(streaming_content=open("/tmp/notes.ods", "rb"),
|
return FileResponse(streaming_content=open("/tmp/notes.ods", "rb"),
|
||||||
content_type="application/vnd.oasis.opendocument.spreadsheet",
|
content_type="application/vnd.oasis.opendocument.spreadsheet",
|
||||||
filename=f"Feuille de notes - {self.object.tournament.name} "
|
filename=f"Feuille de notes - {self.object.tournament.name} "
|
||||||
f"- Poule {self.object.get_letter_display()}{self.object.round}.ods")
|
f"- Poule {self.object.short_name}.ods")
|
||||||
|
|
||||||
|
|
||||||
class NotationSheetTemplateView(VolunteerMixin, DetailView):
|
class NotationSheetTemplateView(VolunteerMixin, DetailView):
|
||||||
|
Loading…
Reference in New Issue
Block a user