def __init__(self, field, request, params, model, model_admin, field_path): self.lookup_kwarg = 'c_type' self.lookup_val = params.pop(self.lookup_kwarg, None) browsers = get_enabled_browsers() browsers = sorted(browsers, key=lambda b: b.link_text) self._browsers = SortedDict([(b.content_type, b) for b in \ browsers if b.content_type])
from django.conf.urls import patterns, url from django.contrib.admin.views.decorators import staff_member_required from adminfiles.views import download, get_enabled_browsers urlpatterns = patterns('', url(r'download/$', staff_member_required(download), name="adminfiles_download") ) for browser in get_enabled_browsers(): slug = browser.slug() urlpatterns += patterns('', url('%s/$' % slug, browser.as_view(), name='adminfiles_%s' % slug))
from django.conf.urls import patterns, url from django.contrib.admin.views.decorators import staff_member_required from adminfiles.views import download, get_enabled_browsers urlpatterns = patterns( '', url(r'download/$', staff_member_required(download), name="adminfiles_download")) for browser in get_enabled_browsers(): slug = browser.slug() urlpatterns += patterns( '', url('%s/$' % slug, browser.as_view(), name='adminfiles_%s' % slug))