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

1.1 drops support for Django 1.7? #115

Closed
robert-kisteleki opened this issue Oct 1, 2015 · 15 comments
Closed

1.1 drops support for Django 1.7? #115

robert-kisteleki opened this issue Oct 1, 2015 · 15 comments

Comments

@robert-kisteleki
Copy link

The doc claims that 1.1 adds support for Django 1.8 and 1.9, while <=1.6 are not supported any more. That's fine, except that 1.7(.10) support also seems to be gone. When clicking on the config in django admin, one gets:

TypeError at /admin/constance/config/
object of type 'Config' has no len()
...
Exception Location: .../python2.7/site-packages/django/utils/functional.py in inner, line 225

This is while using pyhon 2.7. The net result is that one has to upgrade constance exactly at the time of a django upgrade, which is suboptimal. Is this really the case?

@jezdez
Copy link
Member

jezdez commented Oct 1, 2015

can you paste a full traceback please?

@robert-kisteleki
Copy link
Author

It's a 350kb email, not that helpful ;-)

I'll check if I can trim it in a dev environment

@robert-kisteleki
Copy link
Author

OK, at this point all we know is that it breaks in the django template constance/templates/admin/constance/change_list.html, at line 63

However, it seems to be working on a vanilla django install, so the error is probably in the interaction with some other apps and/or ordering. I'll write more if I find anything.

@Jterbeest
Copy link

Hi,

We've traced the problem to the template context processor:
return {"config": constance.config}

If we replace this to for instance:
return {"constance_config": constance.config}

everything works like expected.

@jezdez
Copy link
Member

jezdez commented Oct 1, 2015

The context processor hasn't changed for quite a while so I'm not sure what I can do from here. A full traceback is the only way I can help debug this.

@Jterbeest
Copy link

Here's the full traceback. I doubt it will be helpful as the error has somehow to do with the value of config as it's passed to the template and the trace only show what parts of Django blow up.

Environment:


Request Method: GET
Request URL: https://***/admin/constance/config/

Django Version: 1.7.10
Python Version: 2.7.5
Installed Applications:

Installed Middleware:



Template error:
In template /home/atlas/python/lib/python2.7/site-packages/constance/templates/admin/constance/change_list.html, error at line 63
   object of type 'Config' has no len()
   53 :             {% endif %}


   54 :             <table cellspacing="0" id="result_list">


   55 :                 <thead>


   56 :                 <tr>


   57 :                     <th><div class="text">{% trans "Name" %}</div></th>


   58 :                     <th><div class="text">{% trans "Default" %}</div></th>


   59 :                     <th><div class="text">{% trans "Value" %}</div></th>


   60 :                     <th><div class="text">{% trans "Is modified" %}</div></th>


   61 :                 </tr>


   62 :                 </thead>


   63 :                  {% for item in config %} 


   64 :                 <tr class="{% cycle 'row1' 'row2' %}">


   65 :                     <th>{{ item.name }}


   66 :                         <div class="help">{{ item.help_text|linebreaksbr }}</div>


   67 :                     </th>


   68 :                     <td>


   69 :                         {{ item.default }}


   70 :                     </td>


   71 :                         <td>


   72 :                             {{ item.form_field.errors }}


   73 :                             {{ item.form_field }}


Traceback:
File "/home/atlas/python/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  137.                 response = response.render()
File "/home/atlas/python/lib/python2.7/site-packages/django/template/response.py" in render
  103.             self.content = self.rendered_content
File "/home/atlas/python/lib/python2.7/site-packages/django/template/response.py" in rendered_content
  80.         content = template.render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/base.py" in render
  148.             return self._render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  88.     return self.nodelist.render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  126.         return compiled_parent._render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  88.     return self.nodelist.render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  126.         return compiled_parent._render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  88.     return self.nodelist.render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/atlas/python/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  162.             len_values = len(values)
File "/home/atlas/python/lib/python2.7/site-packages/django/utils/functional.py" in inner
  225.         return func(self._wrapped, *args)

Exception Type: TypeError at /admin/constance/config/
Exception Value: object of type 'Config' has no len()

@jezdez
Copy link
Member

jezdez commented Oct 1, 2015

Aha, thanks, so it happens while rendering the list of config values. I have an idea which change triggered that.

@jezdez jezdez closed this as completed in c82d76f Oct 1, 2015
@jezdez
Copy link
Member

jezdez commented Oct 1, 2015

1.1.1 is out with the fix. Thanks!

@Jterbeest
Copy link

Thanks, we'll test it on Monday :)

@jezdez
Copy link
Member

jezdez commented Oct 2, 2015

Sure, thanks for using constance ;)

@adamrt
Copy link

adamrt commented Oct 7, 2015

Just a heads up, on Django 1.8.1 I had to revert to version 1.1 instead of 1.1.1. I was getting this error, but I goes away on 1.1.

Added context processor
Added installed_apps
Added constance_config
Added constance_backend string for redis

@jezdez
Copy link
Member

jezdez commented Oct 7, 2015

@adamrt Huh, what error?

@adamrt
Copy link

adamrt commented Oct 7, 2015

Hey sorry for not being more specific. I was getting the error for this issue report that has been closed.

object of type 'Config' has no len() - in admin on change_list view

I found this closed issue report and reverted to 1.1 from 1.1.1 since I was already on 1.1.1 and the issue was fixed.

I am running Grappelli though which causes an error with boolean fields being required as well, so that could be my root issue. I am going to do some more digging though to see if I could provide more information.

@bufke
Copy link
Contributor

bufke commented Oct 21, 2015

I got this too, it's certainly from Grappelli. I get it when I have Grappelli and constance.context_processors.config enabled. If I disable the context processor the error goes away but the constance settings don't show in admin.

@vishes-shell
Copy link

vishes-shell commented Apr 18, 2016

If someone facing that problem because of grappelli:
I've been using django-grappelli==2.7.1 and faced with the same problem, but then updated to the django-grappelli==2.8.1 and error faded away.

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

6 participants