I was using Django import-export app and now I want to add Grappelli in order to improve the Admin interface. I'm getting an error related to the templates. Any suggestion to get them work together?
Error:
Environment:
Request Method: GET
Request URL: http://localhost:8000/admin/db_personal/personalinstituto/
Django Version: 1.7c1
Python Version: 2.7.8
Installed Applications:
('grappelli',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'import_export',
'db_personal')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Template error:
In template C:\Gestion AI2\web_nueva\templates\admin\change_list.html, error at line 1
maximum recursion depth exceeded in __instancecheck__
1 : {% extends "admin/change_list.html" %}
2 :
3 : {# Original template renders object-tools only when has_add_permission is True. #}
4 : {# This hack allows sub templates to add to object-tools #}
5 : {% block object-tools %}
6 : <ul class="object-tools">
7 : {% block object-tools-items %}
8 : {% if has_add_permission %}
9 : {{ block.super }}
10 : {% endif %}
11 : {% endblock %}
I've just gone through the same problem and here's a more step-by-step approach.
Create a directory in your project for the import_export templates and add a html file for the change_list_import template.
myproj
├── myproj
│ ├──url.py
│ ├──settings.py
├── manage.py
├── db_personal #myapp
│ ├── admin.py
│ ├── models.py
| ├── viewss.py
├── templates
| ├── admin
| | ├── import_export
| | | ├── change_list_import.html
├── dashboard.py
Next, copy the following code in this template html file. Note that it needs to extend the grappelli changelist template, hence the reference to the location of this template:
{% extends "C:/Python27/lib/site-packages/grappelli/templates/admin/change_list.html" %}
{% load i18n %}
{% block object-tools-items %}
<li><a href="import/" class="import_link">{% trans "Import" %}</a></li>
{{ block.super }}
{% endblock %}