mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Fixed #21382 - Added "has_original" to stacked inlines.
Report and original patch from jrief.
This commit is contained in:
parent
1b29d32894
commit
d25622000a
@ -4,7 +4,7 @@
|
||||
{{ inline_admin_formset.formset.management_form }}
|
||||
{{ inline_admin_formset.formset.non_form_errors }}
|
||||
|
||||
{% for inline_admin_form in inline_admin_formset %}<div class="inline-related{% if forloop.last %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
|
||||
{% for inline_admin_form in inline_admin_formset %}<div class="inline-related{% if inline_admin_form.original or inline_admin_form.show_url %} has_original{% endif %}{% if forloop.last %} empty-form last-related{% endif %}" id="{{ inline_admin_formset.formset.prefix }}-{% if not forloop.last %}{{ forloop.counter0 }}{% else %}empty{% endif %}">
|
||||
<h3><b>{{ inline_admin_formset.opts.verbose_name|capfirst }}:</b> <span class="inline_label">{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %}#{{ forloop.counter }}{% endif %}</span>
|
||||
{% if inline_admin_form.show_url %}<a href="{{ inline_admin_form.absolute_url }}">{% trans "View on site" %}</a>{% endif %}
|
||||
{% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
|
||||
|
@ -239,6 +239,21 @@ class TestInline(TestCase):
|
||||
'<input class="vIntegerField" id="id_editablepkbook_set-2-0-manual_pk" name="editablepkbook_set-2-0-manual_pk" type="text" />',
|
||||
html=True, count=1)
|
||||
|
||||
def test_stacked_inline_edit_form_contains_has_original_class(self):
|
||||
holder = Holder.objects.create(dummy=1)
|
||||
holder.inner_set.create(dummy=1)
|
||||
response = self.client.get('/admin/admin_inlines/holder/%s/' % holder.pk)
|
||||
self.assertContains(
|
||||
response,
|
||||
'<div class="inline-related has_original" id="inner_set-0">',
|
||||
count=1
|
||||
)
|
||||
self.assertContains(
|
||||
response,
|
||||
'<div class="inline-related" id="inner_set-1">',
|
||||
count=1
|
||||
)
|
||||
|
||||
|
||||
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
|
||||
class TestInlineMedia(TestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user