From 3891935d21ca940456e2e9e9ea8f3bf5b6345a01 Mon Sep 17 00:00:00 2001
From: gordon <wgordonw1@gmail.com>
Date: Sat, 23 Feb 2013 18:08:08 -0500
Subject: [PATCH] PoC for #19888 fix
---
django/contrib/admin/helpers.py | 3 +++
django/contrib/admin/templates/admin/edit_inline/tabular.html | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py
index 4203287..2a747c2 100644
a
|
b
|
class InlineAdminForm(AdminForm):
|
289 | 289 | def pk_field(self): |
290 | 290 | return AdminField(self.form, self.formset._pk_field.name, False) |
291 | 291 | |
| 292 | def pk_field_name(self): |
| 293 | return self.formset._pk_field.name |
| 294 | |
292 | 295 | def fk_field(self): |
293 | 296 | fk = getattr(self.formset, "fk", None) |
294 | 297 | if fk: |
diff --git a/django/contrib/admin/templates/admin/edit_inline/tabular.html b/django/contrib/admin/templates/admin/edit_inline/tabular.html
index 71a62ba..5541432 100644
a
|
b
|
|
47 | 47 | <td{% if field.field.name %} class="field-{{ field.field.name }}"{% endif %}> |
48 | 48 | {% if field.is_readonly %} |
49 | 49 | <p>{{ field.contents|linebreaksbr }}</p> |
| 50 | {% if inline_admin_form.pk_field_name == field.field.name %} |
| 51 | <input type="hidden" |
| 52 | value="{{ field.contents }}" |
| 53 | id="id_{{ inline_admin_form.formset.prefix }}-{{ forloop.parentloop.parentloop.parentloop.counter0 }}-{{ field.field.name }}" |
| 54 | name="{{ inline_admin_form.formset.prefix }}-{{ forloop.parentloop.parentloop.parentloop.counter0 }}-{{ field.field.name }}" |
| 55 | readonly /> |
| 56 | {% endif %} |
50 | 57 | {% else %} |
51 | 58 | {{ field.field.errors.as_ul }} |
52 | 59 | {{ field.field }} |