general: allow slicing querysets (#43328)

This commit is contained in:
Frédéric Péters 2020-06-29 16:48:38 +02:00
parent ba0f3a4bb0
commit 9ebb81bd09
1 changed files with 2 additions and 1 deletions

View File

@ -139,7 +139,8 @@ class LazyFormDefObjectsManager(object):
def __getitem__(self, key):
try:
int(key)
if not isinstance(key, slice):
int(key)
except ValueError:
# A django template doing formdef.objects.drafts would start by
# doing ['drafts'], that would raise TypeError and then continue