koleror / django-admin-views

Easily link custom admin views and direct URLs into the Django admin
BSD 3-Clause "New" or "Revised" License
187 stars 33 forks source link

admin_views_install_templates command: TypeError: 'set' object does not support indexing #10

Open sliwowitz opened 10 years ago

sliwowitz commented 10 years ago

When running manage.py admin_views_install_templates, template_dirs is a set which cannot be indexed by [].

$ ./manage.py admin_views_install_templates Traceback (most recent call last): File "./manage.py", line 10, in execute_from_command_line(sys.argv) File "..../python2.7/site-packages/django/core/management/init.py", line 399, in execute_from_command_line utility.execute() File "..../python2.7/site-packages/django/core/management/init.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "..../python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv self.execute(_args, _options.dict) File "..../python2.7/site-packages/django/core/management/base.py", line 285, in execute output = self.handle(_args, _options) File "..../python2.7/site-packages/admin_views/management/commands/admin_views_install_templates.py", line 23, in handle dest_dir = os.path.join(template_dirs[0], 'admin/') TypeError: 'set' object does not support indexing

Since this line is invoked in case when there is only one template directory, you can safely call:

dest_dir = os.path.join(template_dirs.pop(), 'admin/')

instead.