Closes #8175: Display parent object when attaching an image

This commit is contained in:
jeremystretch
2021-12-28 13:06:27 -05:00
parent 798e9da93d
commit e15e2a08b3
3 changed files with 18 additions and 0 deletions

View File

@@ -472,6 +472,7 @@ class ObjectChangeLogView(View):
class ImageAttachmentEditView(generic.ObjectEditView):
queryset = ImageAttachment.objects.all()
model_form = forms.ImageAttachmentForm
template_name = 'extras/imageattachment_edit.html'
def alter_obj(self, instance, request, args, kwargs):
if not instance.pk:

View File

@@ -0,0 +1,16 @@
{% extends 'generic/object_edit.html' %}
{% load helpers %}
{% block form_fields %}
<div class="row mb-3">
<label class="col-sm-3 col-form-label text-lg-end required">
{{ obj.parent|meta:"verbose_name"|bettertitle }}
</label>
<div class="col-sm-9">
<div class="form-control-plaintext">
<a href="{{ obj.parent.get_absolute_url }}" class="">{{ obj.parent }}</a>
</div>
</div>
</div>
{{ block.super }}
{% endblock form_fields %}