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

ValueError on django 1.9.7 #149

Open
PekopT opened this issue Aug 25, 2016 · 1 comment
Open

ValueError on django 1.9.7 #149

PekopT opened this issue Aug 25, 2016 · 1 comment

Comments

@PekopT
Copy link

PekopT commented Aug 25, 2016

Hello!

I'm using python3.4 + django 1.9.7

ValueError at /admin/pages/page/1/change/ invalid literal for int() with base 10: ''
here's stacktraces

Environment:


Request Method: GET
Request URL: admin/pages/page/1/change/

Django Version: 1.9.7
Python Version: 3.4.4
Installed Applications:
['django.contrib.admin',
 'registration',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'django.contrib.sites',
 'django_extensions',
 'social.apps.django_app.default',
 'mptt',
 'rest_framework',
 'sorl.thumbnail',
 'compressor',
 'password_reset',
 'mathfilters',
 'generic_relations',
 'hitcount',
 'django_activeurl',
 'pages',
 'specializations',
 'api',
 'common',
 'work_sell',
 'archilance',
 'projects',
 'users',
 'reviews',
 'chat',
 'wallets',
 'ratings']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 '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',
 'common.middleware.SetLastVisitMiddleware']


Template error:
In template /var/www/archilance/env/lib/python3.4/site-packages/pages/templates/pages/widgets/languages.html, error at line 9
   invalid literal for int() with base 10: ''   1 : {% load i18n pages_tags %}
   2 : <div class="language_choice_widget">
   3 :     <input id="id_language" name="language" type="hidden" value="{{ value }}" />
   4 :     <ul class="clearfix">
   5 :     {% for lang in page_languages %}
   6 :         {% ifequal value lang.0 %}
   7 :             <li><span class="current">{{ lang.0 }}</span></li>
   8 :         {% else %}
   9 :              {% if page|has_content_in:lang.0 %} 
   10 :                 <li><a class="editlink" href="?language={{ lang.0 }}">{{ lang.0 }}</a></li>
   11 :             {% else %}
   12 :                 <li><a class="addlink" href="?language={{ lang.0 }}">{{ lang.0 }}</a></li>
   13 :             {% endif %}
   14 :         {% endifequal %}
   15 :     {% endfor %}
   16 :     </ul>
   17 :     {% if page|has_content_in:value %}
   18 :     <p style="clear:both"><a class="deletelink js-confirm-delete" href="/admin/pages/page/{{
   19 :     page.id }}/delete-content/{{ language }}/">{% trans "Delete this translation" %}</a></p>


Traceback:

File "/var/www/archilance/env/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  174.                     response = self.process_exception_by_middleware(e, request)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  172.                     response = response.render()

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/response.py" in render
  160.             self.content = self.rendered_content

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/response.py" in rendered_content
  137.         content = template.render(context, self._request)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/backends/django.py" in render
  95.             return self.template.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  206.                     return self._render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/loader_tags.py" in render
  173.         return compiled_parent._render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/loader_tags.py" in render
  173.         return compiled_parent._render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/loader_tags.py" in render
  173.         return compiled_parent._render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/loader_tags.py" in render
  69.                 result = block.nodelist.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/defaulttags.py" in render
  220.                     nodelist.append(node.render_annotated(context))

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/loader_tags.py" in render
  209.                 return template.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  208.                 return self._render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/defaulttags.py" in render
  220.                     nodelist.append(node.render_annotated(context))

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/defaulttags.py" in render
  220.                     nodelist.append(node.render_annotated(context))

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/defaulttags.py" in render
  326.                 return nodelist.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/defaulttags.py" in render
  326.                 return nodelist.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  1049.         return render_value_in_context(output, context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_value_in_context
  1026.     value = force_text(value)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/utils/encoding.py" in force_text
  76.                     s = six.text_type(s)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/utils/html.py" in <lambda>
  390.         klass.__str__ = lambda self: mark_safe(klass_str(self))

File "/var/www/archilance/env/lib/python3.4/site-packages/django/forms/boundfield.py" in __str__
  43.         return self.as_widget()

File "/var/www/archilance/env/lib/python3.4/site-packages/django/forms/boundfield.py" in as_widget
  101.         return force_text(widget.render(name, self.value(), attrs=attrs))

File "/var/www/archilance/env/lib/python3.4/site-packages/pages/widgets.py" in render
  113.             'pages/widgets/languages.html', context))

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/loader.py" in render_to_string
  97.         return template.render(context, request)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/backends/django.py" in render
  95.             return self.template.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  206.                     return self._render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in _render
  197.         return self.nodelist.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/defaulttags.py" in render
  220.                     nodelist.append(node.render_annotated(context))

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/defaulttags.py" in render
  294.         return self.nodelist_false.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render
  992.                 bit = node.render_annotated(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in render_annotated
  959.             return self.render(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/defaulttags.py" in render
  319.                     match = condition.eval(context)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/defaulttags.py" in eval
  951.         return self.value.resolve(context, ignore_failures=True)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/template/base.py" in resolve
  736.                 new_obj = func(obj, *arg_vals)

File "/var/www/archilance/env/lib/python3.4/site-packages/pages/templatetags/pages_tags.py" in has_content_in
  58.     return Content.objects.filter(page=page, language=language).count() > 0

File "/var/www/archilance/env/lib/python3.4/site-packages/django/db/models/manager.py" in manager_method
  122.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/db/models/query.py" in filter
  790.         return self._filter_or_exclude(False, *args, **kwargs)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/db/models/query.py" in _filter_or_exclude
  808.             clone.query.add_q(Q(*args, **kwargs))

File "/var/www/archilance/env/lib/python3.4/site-packages/django/db/models/sql/query.py" in add_q
  1243.         clause, _ = self._add_q(q_object, self.used_aliases)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/db/models/sql/query.py" in _add_q
  1269.                     allow_joins=allow_joins, split_subq=split_subq,

File "/var/www/archilance/env/lib/python3.4/site-packages/django/db/models/sql/query.py" in build_filter
  1199.             condition = lookup_class(lhs, value)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/db/models/lookups.py" in __init__
  19.         self.rhs = self.get_prep_lookup()

File "/var/www/archilance/env/lib/python3.4/site-packages/django/db/models/fields/related_lookups.py" in get_prep_lookup
  100.                     self.lookup_name, self.rhs)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/db/models/fields/__init__.py" in get_prep_lookup
  744.             return self.get_prep_value(value)

File "/var/www/archilance/env/lib/python3.4/site-packages/django/db/models/fields/__init__.py" in get_prep_value
  976.         return int(value)

Exception Type: ValueError at /admin/pages/page/1/change/
Exception Value: invalid literal for int() with base 10: ''
@batiste
Copy link
Owner

batiste commented Sep 2, 2016

Could you try with the latest version of the CMS?
Also could you provide more information about your setup? Have you set the setting PAGE_LANGUAGES properly?

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

2 participants