예제 #1
0
파일: models.py 프로젝트: ntwuxc/moocng
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
파일: models.py 프로젝트: ntwuxc/moocng
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
파일: models.py 프로젝트: ntwuxc/moocng
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)