Code

Ticket #18388: ticket_18338.2.diff

File ticket_18338.2.diff, 1.0 KB (added by Melevir, 20 months ago)

This patch is correct. There was some garbage in previous one, sorry for that.

Line 
1diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
2index 19c212d..7a5e93c 100644
3--- a/django/contrib/admin/options.py
4+++ b/django/contrib/admin/options.py
5@@ -1467,8 +1467,8 @@ class InlineModelAdmin(BaseModelAdmin):
6             "fields": fields,
7             "exclude": exclude,
8             "formfield_callback": partial(self.formfield_for_dbfield, request=request),
9-            "extra": self.extra,
10-            "max_num": self.max_num,
11+            "extra": self.get_extra(),
12+            "max_num": self.get_max_num(),
13             "can_delete": can_delete,
14         }
15         defaults.update(kwargs)
16@@ -1519,6 +1519,12 @@ class InlineModelAdmin(BaseModelAdmin):
17         return request.user.has_perm(
18             self.opts.app_label + '.' + self.opts.get_delete_permission())
19 
20+    def get_extra(self):
21+        return self.extra
22+
23+    def get_max_num(self):
24+        return self.max_num
25+
26 
27 class StackedInline(InlineModelAdmin):
28     template = 'admin/edit_inline/stacked.html'