Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango Import-Export: Admin interface "TypeError at /"
    text
    copied!<p>I am trying to figure out how to use Django Import-Export,</p> <p><a href="https://pypi.python.org/pypi/django-import-export" rel="nofollow">https://pypi.python.org/pypi/django-import-export</a></p> <p>by reading the docs</p> <p><a href="https://django-import-export.readthedocs.org/en/latest/getting_started.html#admin-integration" rel="nofollow">https://django-import-export.readthedocs.org/en/latest/getting_started.html#admin-integration</a></p> <h2>Admin Integration:</h2> <p>The gap between the example code and its resulting photo that follows, seems to be vast for my elementary python knowledge.</p> <p>I have managed to code the following:</p> <p>geographical_system/<strong>models.py</strong>:</p> <pre><code>from django.db import models from django.utils.translation import ugettext_lazy as _ class Regional_Units(models.Model): regional_unit = models.CharField( max_length=64, verbose_name=_(u'Regional Units')) def __unicode__(self): return u'%s' % (self.regional_unit) </code></pre> <p>geographical_system/<strong>resources.py</strong>:</p> <pre><code>from import_export import resources from geographical_system.models import Regional_Units from import_export.admin import ImportExportModelAdmin class Regional_Units_Resource(resources.ModelResource): class Meta(object): model = Regional_Units class Regional_Units_Resource_Admin(ImportExportModelAdmin): resouce_class = Regional_Units_Resource # Why originally commented out? #pass #Why pass? </code></pre> <p>geographical_system/<strong>admin.py</strong>:</p> <pre><code>from django.contrib import admin from geographical_system.models import Regional_Units from geographical_system.resources import Regional_Units_Resource_Admin admin.site.register(Regional_Units) admin.site.register(Regional_Units_Resource_Admin) # **Improvising here**, otherwise nothing would happen </code></pre> <h2>Resulting Error</h2> <p>Of course, my improvisation <code>admin.site.register(Regional_Units_Resource_Admin)</code> resulted in the following message when visiting</p> <p><code>http://127.0.0.1:8000/admin/geographical_system/regional_units/</code></p> <pre><code>TypeError at /admin/geographical_system/regional_units/ 'RenameBaseModelAdminMethods' object is not iterable Request Method: GET Request URL: http://127.0.0.1:8000/admin/geographical_system/regional_units/ Django Version: 1.6 Exception Type: TypeError Exception Value: 'RenameBaseModelAdminMethods' object is not iterable Exception Location: /home/flyer/.virtualenvs/rara/lib/python2.7/site-packages/django/contrib/admin/sites.py in register, line 71 Python Executable: /home/flyer/.virtualenvs/rara/bin/python Python Version: 2.7.5 Python Path: ['/home/flyer/02/rara', '/home/flyer/.virtualenvs/rara/lib64/python27.zip', '/home/flyer/.virtualenvs/rara/lib64/python2.7', '/home/flyer/.virtualenvs/rara/lib64/python2.7/plat-linux2', '/home/flyer/.virtualenvs/rara/lib64/python2.7/lib-tk', '/home/flyer/.virtualenvs/rara/lib64/python2.7/lib-old', '/home/flyer/.virtualenvs/rara/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7', '/usr/lib/python2.7', '/usr/lib64/python2.7/lib-tk', '/home/flyer/.virtualenvs/rara/lib/python2.7/site-packages'] </code></pre> <h2>Questions</h2> <ul> <li>Why is this error appearing?</li> <li>How could I end - up into this beautiful admin interface where Import and Export options are enabled?</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload