Пример #1
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,
    }
Пример #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
 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 ""