Пример #1
0
def unit_invalidate_cache(sender, instance, **kwargs):
    try:
        invalidate_template_fragment_i18n('course_overview_secondary_info',
                                          instance.course.id)
    except Course.DoesNotExist:
        # The course is being deleted, nothing to invalidate
        pass
Пример #2
0
def announcement_invalidate_cache(sender, instance, **kwargs):
    try:
        if instance.course:  # else: globals announcements
            invalidate_template_fragment_i18n('course_overview_secondary_info',
                                              instance.course.id)
    except Course.DoesNotExist:
        logger.error('Saving/removing announcement. Can\'t invalidate course '
                     'sidebar html, not valid reference to course object, '
                     'it is probably being deleted...')
Пример #3
0
def course_invalidate_cache(sender, instance, **kwargs):
    invalidate_template_fragment_i18n('course_list')
    invalidate_template_fragment_i18n('course_overview_main_info', instance.id)
    invalidate_template_fragment_i18n('course_overview_secondary_info', instance.id)
Пример #4
0
    def _invalidate_course_cache(self, course):
        self.stdout.write('Invalidating cache for %s\n' % course)

        invalidate_template_fragment_i18n('course_list')
        invalidate_template_fragment_i18n('course_overview_main_info', course.id)
        invalidate_template_fragment_i18n('course_overview_secondary_info', course.id)