mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Fixed #23489 -- Added numpy 1.9+ support in template lookups
This commit is contained in:
		| @@ -767,7 +767,9 @@ class Variable(object): | |||||||
|             for bit in self.lookups: |             for bit in self.lookups: | ||||||
|                 try:  # dictionary lookup |                 try:  # dictionary lookup | ||||||
|                     current = current[bit] |                     current = current[bit] | ||||||
|                 except (TypeError, AttributeError, KeyError, ValueError): |                     # ValueError/IndexError are for numpy.array lookup on | ||||||
|  |                     # numpy < 1.9 and 1.9+ respectively | ||||||
|  |                 except (TypeError, AttributeError, KeyError, ValueError, IndexError): | ||||||
|                     try:  # attribute lookup |                     try:  # attribute lookup | ||||||
|                         # Don't return class attributes if the class is the context: |                         # Don't return class attributes if the class is the context: | ||||||
|                         if isinstance(current, BaseContext) and getattr(type(current), bit): |                         if isinstance(current, BaseContext) and getattr(type(current), bit): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user