On affiche une chronologie en pied des événements
This commit is contained in:
parent
504198b14f
commit
bc06b6205d
@ -811,6 +811,29 @@ class Event(models.Model):
|
||||
models.Index("start_time", "start_day", "end_day", "end_time", Lower("title"), name="datetimes title")
|
||||
]
|
||||
|
||||
def chronology(self):
|
||||
c = []
|
||||
if self.modified_date:
|
||||
c.append({ "timestamp": self.modified_date, "data": "modified_date", "user": self.modified_by_user, "is_date": True })
|
||||
if self.moderated_date:
|
||||
c.append({ "timestamp": self.moderated_date, "data": "moderated_date", "user" : self.moderated_by_user, "is_date": True})
|
||||
if self.imported_date:
|
||||
c.append({ "timestamp": self.imported_date, "data": "imported_date", "user": self.imported_by_user, "is_date": True })
|
||||
if self.created_date:
|
||||
c.append({ "timestamp": self.created_date + timedelta(milliseconds=-1), "data": "created_date", "user": self.created_by_user, "is_date": True})
|
||||
|
||||
c += [{ "timestamp": m.date, "data": m, "user": m.user, "is_date": False} for m in self.message_set.filter(spam=False)]
|
||||
|
||||
if self.other_versions:
|
||||
for o in self.other_versions.get_duplicated():
|
||||
if o != self:
|
||||
c += [{ "timestamp": m.date, "data": m, "user": m.user, "is_date": False} for m in o.message_set.filter(spam=False)]
|
||||
|
||||
|
||||
c.sort(key=lambda x: x["timestamp"])
|
||||
|
||||
return c
|
||||
|
||||
def sorted_tags(self):
|
||||
if self.tags is None:
|
||||
return []
|
||||
|
@ -1572,4 +1572,35 @@ label.required::after {
|
||||
.a-venir .line-now {
|
||||
margin-left: -2em;
|
||||
|
||||
}
|
||||
|
||||
.chronology {
|
||||
.entree {
|
||||
display: grid;
|
||||
grid-template-columns: fit-content(2em) auto;
|
||||
column-gap: .7em;
|
||||
.texte {
|
||||
background: var(--background-color);
|
||||
padding: 0.1em 0.8em;
|
||||
border-radius: var(--border-radius);
|
||||
p {
|
||||
font-size: 100%;
|
||||
}
|
||||
p:last-child {
|
||||
margin-bottom: 0.1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
font-size: 85%;
|
||||
footer {
|
||||
margin-top: 1.8em;
|
||||
padding: 0.2em .8em;
|
||||
}
|
||||
.ts {
|
||||
@extend .badge-small;
|
||||
border-radius: var(--border-radius);
|
||||
display: inline-block;
|
||||
width: 14em;
|
||||
margin-right: 1.2em;
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
{% if user.is_authenticated %}
|
||||
<p class="footer">Création : {{ event.created_date }}
|
||||
<p class="footer">Création : {{ event.created_date }}{% if event.created_by_user %} par <em>{{ event.created_by_user.username }}</em>{% endif %}
|
||||
{% if event.modified %}
|
||||
— dernière modification : {{ event.modified_date }}
|
||||
— dernière modification : {{ event.modified_date }}{% if event.modified_by_user %} par <em>{{ event.modified_by_user.username }}</em>{% endif %}
|
||||
{% endif %}
|
||||
{% if event.imported_date %}
|
||||
— dernière importation : {{ event.imported_date }}
|
||||
— dernière importation : {{ event.imported_date }}{% if event.imported_by_user %} par <em>{{ event.imported_by_user.username }}</em>{% endif %}
|
||||
{% endif %}
|
||||
{% if event.moderated_date %}
|
||||
— dernière modération : {{ event.moderated_date }}
|
||||
— dernière modération : {{ event.moderated_date }}{% if event.moderated_by_user %} par <em>{{ event.moderated_by_user.username }}</em>{% endif %}
|
||||
{% endif %}
|
||||
{% if event.pure_import %}
|
||||
— <strong>version importée</strong>
|
||||
|
@ -1,10 +1,12 @@
|
||||
<footer class="remarque">
|
||||
Informations complémentaires non éditables :
|
||||
<strong>Informations complémentaires non éditables</strong>
|
||||
<ul>
|
||||
{% if object.created_date %}<li>Création : {{ object.created_date }}{% if object.created_by_user %} par <em>{{ object.created_by_user.username }}</em>{% endif %}</li>{% endif %}
|
||||
{% if object.modified_date %}<li>Dernière modification : {{ object.modified_date }}{% if object.modified_by_user %} par <em>{{ object.modified_by_user.username }}</em>{% endif %}</li>{% endif %}
|
||||
{% if object.moderated_date %}<li>Dernière modération : {{ object.moderated_date }}{% if object.moderated_by_user %} par <em>{{ object.moderated_by_user.username }}</em>{% endif %}</li>{% endif %}
|
||||
{% if object.imported_date %}<li>Dernière importation : {{ object.imported_date }}{% if object.imported_by_user %} par <em>{{ object.imported_by_user.username }}</em>{% endif %}</li>{% endif %}
|
||||
{% if not allbutdates %}
|
||||
{% if object.created_date %}<li>Création : {{ object.created_date }}{% if object.created_by_user %} par <em>{{ object.created_by_user.username }}</em>{% endif %}</li>{% endif %}
|
||||
{% if object.modified_date %}<li>Dernière modification : {{ object.modified_date }}{% if object.modified_by_user %} par <em>{{ object.modified_by_user.username }}</em>{% endif %}</li>{% endif %}
|
||||
{% if object.moderated_date %}<li>Dernière modération : {{ object.moderated_date }}{% if object.moderated_by_user %} par <em>{{ object.moderated_by_user.username }}</em>{% endif %}</li>{% endif %}
|
||||
{% if object.imported_date %}<li>Dernière importation : {{ object.imported_date }}{% if object.imported_by_user %} par <em>{{ object.imported_by_user.username }}</em>{% endif %}</li>{% endif %}
|
||||
{% endif %}
|
||||
{% if object.uuids %}
|
||||
{% if object.uuids|length > 0 %}
|
||||
<li>UUIDs (identifiants uniques d'événements dans les sources) :
|
||||
|
@ -17,24 +17,54 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% with cache_timeout=user.is_authenticated|yesno:"30,600" %}
|
||||
{% cache cache_timeout event user.is_authenticated event %}
|
||||
|
||||
|
||||
<div class="grid two-columns">
|
||||
<div>
|
||||
{% with cache_timeout=user.is_authenticated|yesno:"30,600" %}
|
||||
{% cache cache_timeout event_body user.is_authenticated event %}
|
||||
{% include "agenda_culturel/single-event/event-single-inc.html" with event=event filter=filter %}
|
||||
{% endcache %}
|
||||
{% endwith %}
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
<article>
|
||||
<article class="chronology">
|
||||
<header>
|
||||
<h2>Informations internes</h2>
|
||||
<h2>Chronologie</h2>
|
||||
</header>
|
||||
{% include "agenda_culturel/event-info-inc.html" with object=event %}
|
||||
{% for step in event.chronology %}
|
||||
{% if step.is_date %}
|
||||
<div class="entree dateline">
|
||||
<div><span class="ts">{{ step.timestamp }}</span></div>
|
||||
<div>
|
||||
{% if step.data == "created_date" %}<em>création</em>{% endif %}
|
||||
{% if step.data == "modified_date" %}<em>dernière modification</em>{% endif %}
|
||||
{% if step.data == "moderated_date" %}<em>dernière modération</em>{% endif %}
|
||||
{% if step.data == "imported_date" %}<em>dernière importation</em>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="entree">
|
||||
<div><span class="ts">{{ step.timestamp }}</span></div>
|
||||
<div>
|
||||
<header><strong>Message</strong>{% if step.data.related_event and event != step.data.related_event %} sur <a href="{{ step.data.related_event.get_absolute_url }}">une autre</a> version{% endif %} : <a href="{{ step.data.get_absolute_url }}">{{ step.data.subject|truncatechars:20 }}</a> {% if step.data.user %} par <em>{{ step.data.user }}</em>{% else %} par {{ step.data.name }} (<a href="mailto: {{ step.data.email }}">{{ step.data.email }}</a>){% endif %}</header>
|
||||
<div class="texte">{{ step.data.message|safe }}</div>
|
||||
{% if step.data.comments %}
|
||||
<div><strong>Commentaire :</strong> {{ step.data.comments }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% include "agenda_culturel/event-info-inc.html" with allbutdates=1 %}
|
||||
</article>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
{% with cache_timeout=user.is_authenticated|yesno:"30,600" %}
|
||||
{% cache cache_timeout event_aside user.is_authenticated event %}
|
||||
<aside>
|
||||
{% with event.get_concurrent_events as concurrent_events %}
|
||||
{% if concurrent_events %}
|
||||
@ -99,10 +129,10 @@
|
||||
|
||||
|
||||
</aside>
|
||||
|
||||
{% endcache %}
|
||||
{% endwith %}
|
||||
|
||||
</div>
|
||||
{% endcache %}
|
||||
{% endwith %}
|
||||
|
||||
|
||||
{% endblock %}
|
@ -472,7 +472,7 @@ class EventDeleteView(
|
||||
class EventDetailView(UserPassesTestMixin, DetailView):
|
||||
model = Event
|
||||
template_name = "agenda_culturel/page-event.html"
|
||||
queryset = Event.objects.select_related("exact_location").select_related("category").select_related("other_versions").select_related("other_versions__representative")
|
||||
queryset = Event.objects.select_related("exact_location").select_related("category").select_related("other_versions").select_related("other_versions__representative").prefetch_related("message_set")
|
||||
|
||||
|
||||
def test_func(self):
|
||||
|
Loading…
Reference in New Issue
Block a user