Commit b03ee49a by Toby Lawrence

Fix up the excluded extensions bit.

This adds the missing admin class, and registration of it, required to
actually change the value of the excluded extensions configuration.
parent 8a2d9893
...@@ -5,7 +5,7 @@ that gets prepended to asset URLs in order to serve them from, say, a CDN. ...@@ -5,7 +5,7 @@ that gets prepended to asset URLs in order to serve them from, say, a CDN.
from django.contrib import admin from django.contrib import admin
from config_models.admin import ConfigurationModelAdmin from config_models.admin import ConfigurationModelAdmin
from .models import AssetBaseUrlConfig from .models import AssetBaseUrlConfig, AssetExcludedExtensionsConfig
class AssetBaseUrlConfigAdmin(ConfigurationModelAdmin): class AssetBaseUrlConfigAdmin(ConfigurationModelAdmin):
...@@ -27,4 +27,24 @@ class AssetBaseUrlConfigAdmin(ConfigurationModelAdmin): ...@@ -27,4 +27,24 @@ class AssetBaseUrlConfigAdmin(ConfigurationModelAdmin):
return self.list_display return self.list_display
class AssetExcludedExtensionsConfigAdmin(ConfigurationModelAdmin):
"""
Basic configuration for asset base URL.
"""
list_display = [
'excluded_extensions'
]
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(AssetBaseUrlConfig, AssetBaseUrlConfigAdmin) admin.site.register(AssetBaseUrlConfig, AssetBaseUrlConfigAdmin)
admin.site.register(AssetExcludedExtensionsConfig, AssetExcludedExtensionsConfigAdmin)
...@@ -48,7 +48,7 @@ class AssetExcludedExtensionsConfig(ConfigurationModel): ...@@ -48,7 +48,7 @@ class AssetExcludedExtensionsConfig(ConfigurationModel):
return map(add_period, cls.current().excluded_extensions.split()) return map(add_period, cls.current().excluded_extensions.split())
def __repr__(self): def __repr__(self):
return '<AssetExcludedExtensionsConfig(extensions={})>'.format(self.get_excluded_extensions().split()) return '<AssetExcludedExtensionsConfig(extensions={})>'.format(self.get_excluded_extensions())
def __unicode__(self): def __unicode__(self):
return unicode(repr(self)) return unicode(repr(self))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment