def get_external_object_queryset(self): if not self.external_object_queryset and not self.external_object_class: raise ImproperlyConfigured( 'View must provide either an external_object_queryset, ' 'an external_object_class or a custom ' 'get_external_object_queryset() method.') queryset = self.external_object_queryset if not queryset: manager = ModelPermission.get_manager( model=self.external_object_class) queryset = manager.all() return queryset
def get_external_object_queryset(self): if self.external_object_queryset is not None: queryset = self.external_object_queryset if isinstance(queryset, QuerySet): queryset = queryset.all() elif self.external_object_class is not None: manager = ModelPermission.get_manager( model=self.external_object_class) queryset = manager.all() else: raise ImproperlyConfigured( 'View `{}` must provide either an external_object_queryset, ' 'an external_object_class or a custom ' 'get_external_object_queryset() method.'.format( self.__class__.__name__)) return queryset