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,
    }
示例#2
0
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,
    }
示例#3
0
文件: ui.py 项目: hanleybrand/rooibos
 def render(self, context):
     user = self.user.resolve(context)
     context[self.var_name] = fetch_current_presentation(user)
     return ''
示例#4
0
 def render(self, context):
     user = self.user.resolve(context)
     context[self.var_name] = fetch_current_presentation(user)
     return ""