def current_presentation(request): presentation = SimpleLazyObject(lambda: fetch_current_presentation(request.user)) def get_presentation_records(): try: return list(presentation.items.values_list('record_id', flat=True).distinct()) except AttributeError: return [] presentation_records = IterableLazyObject(get_presentation_records) return { 'current_presentation': presentation, 'current_presentation_records': presentation_records, }
def render(self, context): user = self.user.resolve(context) context[self.var_name] = fetch_current_presentation(user) return ''
def render(self, context): user = self.user.resolve(context) context[self.var_name] = fetch_current_presentation(user) return ""