Amélioration de la navigation entre événement et import

This commit is contained in:
Jean-Marie Favreau 2024-10-19 19:50:56 +02:00
parent 4b97f8c222
commit 47b91b20fd
2 changed files with 15 additions and 2 deletions

View File

@ -511,6 +511,19 @@ class Event(models.Model):
},
)
def get_import_sources(self):
if self.import_sources:
result = []
for s in self.import_sources:
o_s = RecurrentImport.objects.get(source=s)
if o_s:
result.append((o_s.get_absolute_url(), o_s.name))
else:
result.append((o_s, o_s))
return result
else:
return []
def __str__(self):
return _date(self.start_day) + ": " + self.title

View File

@ -19,8 +19,8 @@
{% if object.import_sources|length > 0 %}
<li>Sources d'import&nbsp;:
<ul>
{% for u in object.import_sources %}
<li><a href="{{ u }}">{{ u }}</a></li>
{% for u, t in object.get_import_sources %}
<li><a href="{{ u }}">{{ t }}</a></li>
{% endfor %}
</ul>
</li>