Skip to content

Commit 5ef24fe

Browse files
C4ptainCrunchclaude
andcommitted
Track staff pick changes in moderation log and clean up history details
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 02a1ba5 commit 5ef24fe

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

documents/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def document_edit(request, pk):
129129
old_name = doc.name
130130
old_description = doc.description
131131
old_tags = list(doc.tags.all())
132+
old_staff_pick = doc.staff_pick
132133

133134
form = DocumentForm(request.POST, instance=doc)
134135

@@ -144,6 +145,7 @@ def document_edit(request, pk):
144145
form.cleaned_data["description"],
145146
),
146147
"tags": (old_tags, form.cleaned_data["tags"]),
148+
"staff_pick": (old_staff_pick, form.cleaned_data["staff_pick"]),
147149
},
148150
)
149151

moderation/models.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def __str__(self):
7171
"description": "description",
7272
"tags": "tags",
7373
"hidden": "visibilité",
74+
"staff_pick": "staff pick",
7475
}
7576

7677
@property
@@ -98,6 +99,12 @@ def document_action_text(self):
9899
return "re-upload"
99100
if self.target_field == "hidden":
100101
return "caché" if str(self.new_value) == "True" else "rendu visible"
102+
if self.target_field == "staff_pick":
103+
return (
104+
"ajouté staff pick"
105+
if str(self.new_value) == "True"
106+
else "retiré staff pick"
107+
)
101108
label = self.FIELD_LABELS.get(self.target_field, self.target_field)
102109
return f"modifié {label}"
103110

moderation/templates/moderation/document_history.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ <h1 class="mb-0">Historique de modération</h1>
4949
</span>
5050
</td>
5151
<td class="small text-muted">
52-
{% if log.old_value and log.new_value and log.target_field != "reupload" %}
52+
{% if log.target_field == "reupload" %}
53+
{{ log.new_value }}
54+
{% elif log.target_field != "hidden" and log.target_field != "staff_pick" and log.old_value and log.new_value %}
5355
<span class="text-decoration-line-through">{{ log.old_value|truncatewords:15 }}</span>
5456
&rarr; {{ log.new_value|truncatewords:15 }}
55-
{% elif log.target_field == "reupload" %}
56-
{{ log.new_value }}
5757
{% endif %}
5858
</td>
5959
</tr>

0 commit comments

Comments
 (0)