on améliore la gestion des dupliqués

This commit is contained in:
Jean-Marie Favreau 2024-05-03 14:19:18 +02:00
parent 750832bf71
commit 4d6187113d
2 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
{% extends "agenda_culturel/page.html" %}
{% load utils_extra %}
{% load event_extra %}
{% block title %}Événements possiblement dupliqués{% endblock %}
@ -24,7 +25,7 @@
</header>
<ul>
{% for e in events %}
<li>{{ e.start_day }}{% if e.start_time %} à {{ e.start_time }}{% endif %}&nbsp;: <a href="{{ e.get_absolute_url }}">{{ e.title }}</a> créé le {{ e.created_date }}</li>
<li>{{ e.start_day }}{% if e.start_time %} à {{ e.start_time }}{% endif %}&nbsp;: {{ e|picto_status }} <a href="{{ e.get_absolute_url }}">{{ e.title }}</a> créé le {{ e.created_date }}</li>
{% endfor %}
</ul>
{% if perms.agenda_culturel.change_duplicatedevents %}

View File

@ -1085,6 +1085,8 @@ def merge_duplicate(request, pk):
for e in events:
e.status = Event.STATUS.TRASH
Event.objects.bulk_update(events, fields=["status"])
# remove duplicate
edup.delete()
messages.info(request, _("The merge has been successfully completed."))
return HttpResponseRedirect(new_event.get_absolute_url())