include caption in gallery photo selection search

This commit is contained in:
j 2025-03-29 10:54:23 +00:00
parent c7e08ddc32
commit 6a4319220d
2 changed files with 12 additions and 4 deletions

View file

@ -8,16 +8,24 @@
</p>
<ul class="sortedm2m-items">
{% for row in selected %}
<li class="sortedm2m-item"><label{{ row.label_for|safe }}>{{ row.rendered_cb }} {{ row | admin_thumbnail }} {{ row.option_label }}</label></li>
<li class="sortedm2m-item"><label{{ row.label_for|safe }}>{{ row.rendered_cb }} {{ row | admin_thumbnail }} <div>{{ row.option_label }}</div></label></li>
{% endfor %}
{% for row in unselected %}
<li class="sortedm2m-item"><label{{ row.label_for|safe }}>{{ row.rendered_cb }} {{ row | admin_thumbnail }}{{ row.option_label }}</label></li>
<li class="sortedm2m-item"><label{{ row.label_for|safe }}>{{ row.rendered_cb }} {{ row | admin_thumbnail }}<div>{{ row.option_label }}</div></label></li>
{% endfor %}
</ul>
<p class="help">
{% trans "Choose items and order by drag & drop." %}
</p>
<style>
.sortedm2m-container ul label {
display: flex;
gap: 8px;
}
.sortedm2m-item > label > div {
text-wrap-mode: wrap;
}
</style>
</div>

View file

@ -539,7 +539,7 @@ class Photo(ImageModel):
verbose_name_plural = _("photos")
def __str__(self):
return self.title
return "%s\n%s" % (self.title, self.caption)
def save(self, *args, **kwargs):
# If crop_from or effect property has been changed on existing image,