Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in templatetag with Django 1.8 #10

Closed
stefanfoulis opened this issue May 7, 2015 · 2 comments
Closed

error in templatetag with Django 1.8 #10

stefanfoulis opened this issue May 7, 2015 · 2 comments

Comments

@stefanfoulis
Copy link

Environment:


Request Method: GET
Request URL: http://appctl.local.aldryn.net/admin/app_controller/host/05a88020-9587-4207-9ed0-b02d39f5fe96/

Django Version: 1.8.1
Python Version: 2.7.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'app_controller',
 'rest_framework',
 'rest_framework.authtoken',
 'gunicorn',
 'relatives')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Template error:
In template /usr/local/lib/python2.7/dist-packages/relatives/templates/relatives/change_form.html, error at line 8
   tuple index out of range

   1 : {% extends "admin/change_form.html" %}



   2 : 



   3 : {% block content %}



   4 : 



   5 : <div id="content-main">



   6 : 



   7 : {% load relatives %}



   8 :  {% related_objects adminform.form.instance as related_objects %} 



   9 : <div class="module grp-module" id="filter">



   10 :   {% block relations %}



   11 :   <h2>Relations</h2>



   12 :   <ul>



   13 :   {% for related in related_objects %}



   14 :     <li><a href="{{ related.url }}">



   15 :       {{ related.plural_name|capfirst }}



   16 :     </a></li>



   17 :   {% endfor %}



   18 :   {% endblock relations %}


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  164.                 response = response.render()
File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in render
  158.             self.content = self.rendered_content
File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in rendered_content
  135.         content = template.render(context, self._request)
File "/usr/local/lib/python2.7/dist-packages/django/template/backends/django.py" in render
  74.         return self.template.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
  209.                     return self._render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in _render
  201.         return self.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in _render
  201.         return self.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in _render
  201.         return self.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py" in render
  135.         return compiled_parent._render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in _render
  201.         return self.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
  903.                 bit = self.render_node(node, context)
File "/usr/local/lib/python2.7/dist-packages/django/template/debug.py" in render_node
  79.             return node.render(context)
File "/usr/local/lib/python2.7/dist-packages/django/template/base.py" in render
  1227.                     context[self.target_var] = func(*resolved_args, **resolved_kwargs)
File "/usr/local/lib/python2.7/dist-packages/relatives/templatetags/relatives.py" in related_objects
  61.                           *related.name.split(':')))

Exception Type: IndexError at /admin/app_controller/host/05a88020-9587-4207-9ed0-b02d39f5fe96/
Exception Value: tuple index out of range
@treyhunner
Copy link
Owner

Thank you for reporting this @stefanfoulis! I am not currently running this app on Django 1.8.

My suggestion for you or anyone who would like to update this app to work with 1.8:

  • Update the tox.ini file to add py27-1.8, py33-1.8, or py34-1.8 (both at the top of the file and as a new section in the file)
  • Run the tests (see contributing file)
  • Fix one test at a time

@fizista
Copy link

fizista commented Jan 9, 2016

Hi...

I fixed some tests and a library part. I also added a test project that can help improve error in Django 1.8 / 1.9.

fizista@69abfe9

Unfortunately I do not have time to correct these tests:

ERROR: test_foreign_keys (relatives.tests.tests.RelatedObjectsTagTest)
ERROR: test_many_to_many (relatives.tests.tests.RelatedObjectsTagTest)
ERROR: test_no_admin_url (relatives.tests.tests.RelatedObjectsTagTest)
FAIL: test_add_form_for_non_nullable_fk (relatives.tests.tests.TemplateFilterTest)
FAIL: test_nullable_foreign_key (relatives.tests.tests.TemplateFilterTest)

Maybe someone will find time to complete the code migration to new versions of Django.

I also added a test site, making it easier to probably complete the migration:

cd relatives/tests/
./manage.py migrate
./manage.py createsuperuser --username admin --email admin@example.com
./manage.py runserver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants