gregmuellegger / django-mobile

Detect mobile browsers and serve different template flavours to them.
http://pypi.python.org/pypi/django-mobile
BSD 3-Clause "New" or "Revised" License
560 stars 170 forks source link

Got 'django.template.loader_tags.ExtendsError' when customizing admin interface in Django 1.9 #68

Closed wolfg1969 closed 6 years ago

wolfg1969 commented 8 years ago

I have customizedd admin page by extending 'admin/base_site.html' template. The admin page is broken after add 'django_mobile.loader.Loader' to loaders of TEMPLATES settings. The error is 'ExtendsError: Cannot extend templates recursively when using non-recursive template loaders'.

My TEMPLATES Settings is below:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'sekizai.context_processors.sekizai',
                'django_mobile.context_processors.flavour',
            ],
            'loaders': [
                'django_mobile.loader.Loader',
                'django.template.loaders.filesystem.Loader',
                'django.template.loaders.app_directories.Loader',
            ]
        },
    },
]
gregmuellegger commented 8 years ago

Seems like that is a matter of implementing the get_contents method on the mobile loader. See here: https://github.com/django/django/blob/master/django/template/loaders/base.py#L104

I think I won't get to that soonish.

@wolfg1969 would you like to create a pull request to solve this issue?

wolfg1969 commented 8 years ago

ok, I'll try it.