On ajoute un message quand un événement est mis à jour pour indiquer les champs concernés
This commit is contained in:
parent
28e9a5454b
commit
27933f2454
@ -1663,13 +1663,26 @@ class Event(models.Model):
|
|||||||
break
|
break
|
||||||
|
|
||||||
if same_imported:
|
if same_imported:
|
||||||
|
if not event.similar(same_imported, False):
|
||||||
# reopen DuplicatedEvents if required
|
# reopen DuplicatedEvents if required
|
||||||
if not event.similar(same_imported, False) and same_imported.other_versions:
|
if same_imported.other_versions:
|
||||||
if same_imported.status != Event.STATUS.TRASH:
|
if same_imported.status != Event.STATUS.TRASH:
|
||||||
if same_imported.other_versions.is_published():
|
if same_imported.other_versions.is_published():
|
||||||
if same_imported.other_versions.representative != same_imported:
|
if same_imported.other_versions.representative != same_imported:
|
||||||
same_imported.other_versions.representative = None
|
same_imported.other_versions.representative = None
|
||||||
same_imported.other_versions.save()
|
same_imported.other_versions.save()
|
||||||
|
# add a message to explain the update
|
||||||
|
res = [r for r in Event.get_comparison([event, same_imported], all) if not r["similar"]]
|
||||||
|
if len(res) > 0:
|
||||||
|
txt = _("Updated field(s): ") + ", ".join([r["key"] for r in res])
|
||||||
|
msg = Message(subject=_('Update'),
|
||||||
|
name=_('update process'),
|
||||||
|
related_event=same_imported,
|
||||||
|
message=txt,
|
||||||
|
message_type=Message.TYPE.UPDATE_PROCESS)
|
||||||
|
msg.save()
|
||||||
|
|
||||||
|
|
||||||
# we only update local information if it's a pure import and has no moderated_date
|
# we only update local information if it's a pure import and has no moderated_date
|
||||||
new_image = same_imported.image != event.image
|
new_image = same_imported.image != event.image
|
||||||
same_imported.update(event, pure and same_imported.moderated_date is None)
|
same_imported.update(event, pure and same_imported.moderated_date is None)
|
||||||
@ -1911,6 +1924,7 @@ class Message(models.Model):
|
|||||||
class TYPE(models.TextChoices):
|
class TYPE(models.TextChoices):
|
||||||
FROM_CONTRIBUTOR = "from_contributor", _("From contributor")
|
FROM_CONTRIBUTOR = "from_contributor", _("From contributor")
|
||||||
IMPORT_PROCESS = "import_process", _("Import process")
|
IMPORT_PROCESS = "import_process", _("Import process")
|
||||||
|
UPDATE_PROCESS = "update_process", _("Update process")
|
||||||
CONTACT_FORM = "contact_form", _("Contact form")
|
CONTACT_FORM = "contact_form", _("Contact form")
|
||||||
EVENT_REPORT = "event_report", _("Event report")
|
EVENT_REPORT = "event_report", _("Event report")
|
||||||
FROM_CONTRIBUTOR_NO_MSG = "from_contrib_no_msg", _("From contributor (without message)")
|
FROM_CONTRIBUTOR_NO_MSG = "from_contrib_no_msg", _("From contributor (without message)")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user