(self)
return self._length
Cached data length
Cached data length
Cached data length
def __len__(self):
        """Cached data length"""
        if not hasattr(self, "_length") or self._length is None:
            if hasattr(self.table, "paginator"):
                # for paginated tables, use QuerySet.count() as we are interested in total number of records.
                self._length = self.data.count()
            else:
                # for non-paginated tables, use the length of the QuerySet
                self._length = len(self.data)

        return self._length
def __len__ ( self ) : if not hasattr ( self , "_length" ) or self . _length is None : if hasattr ( self . table , "paginator" ) : # for paginated tables, use QuerySet.count() as we are interested in total number of records. self . _length = self . data . count ( ) else : # for non-paginated tables, use the length of the QuerySet self . _length = len ( self . data ) return self . _length