1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed ModelAdmin.get_max_num() example if obj is None.

This commit is contained in:
Riccardo Magliocchetti
2016-10-17 13:33:38 +02:00
committed by Tim Graham
parent 86bb9a0502
commit a4e9e834e3

View File

@@ -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