Files
edx-platform/common/djangoapps/contentserver/admin.py
Toby Lawrence 01a9ad2369 Add support to enhance the cacheability of course assets.
This introduces a mechanism to control the time-to-live for an unlocked
course asset, which will allow browsers and intermediate proxies/caches
to cache these course assets, determinstically.

Locked assets, with their nature of requiring authorization, are not
eligible for caching.
2016-01-26 21:09:18 -05:00

30 lines
872 B
Python

"""
Django admin page for CourseAssetCacheTtlConfig, which allows you to configure the TTL
that gets used when sending cachability headers back with request course assets.
"""
from django.contrib import admin
from config_models.admin import ConfigurationModelAdmin
from .models import CourseAssetCacheTtlConfig
class CourseAssetCacheTtlConfigAdmin(ConfigurationModelAdmin):
"""
Basic configuration for cache TTL.
"""
list_display = [
'cache_ttl'
]
def get_list_display(self, request):
"""
Restore default list_display behavior.
ConfigurationModelAdmin overrides this, but in a way that doesn't
respect the ordering. This lets us customize it the usual Django admin
way.
"""
return self.list_display
admin.site.register(CourseAssetCacheTtlConfig, CourseAssetCacheTtlConfigAdmin)