From a4e9e834e3dfc8d5a024a78c765f193105d41a48 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Mon, 17 Oct 2016 13:33:38 +0200 Subject: [PATCH] Fixed ModelAdmin.get_max_num() example if obj is None. --- docs/ref/contrib/admin/index.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 4d3ab6dc1f..7918286675 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -2212,7 +2212,7 @@ The ``InlineModelAdmin`` class adds: def get_max_num(self, request, obj=None, **kwargs): max_num = 10 - if obj.parent: + if obj and obj.parent: return max_num - 5 return max_num