Friday, April 17, 2015

Re: invalid literal for int() with base 10 trying to access uploaded image


Hi Kelvin,


I am also having the similar issue where i am not able to solve it
invalid literal for int() with base 10: ''
Request Method:POST
Request URL:http://172.19.7.125:8001/super-admin-dashboard/status-change/
Django Version:1.6
Exception Type:ValueError
Exception Value:
invalid literal for int() with base 10: ''
Exception Location:/usr/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py in get_prep_value, line 1073
Python Executable:/usr/local/bin/python
Python Version:2.7.3
Python Path:
['/home/kra/jyothi_pms',   '/usr/local/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/python_ntlm-1.0.1-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/cx_Oracle-5.1.2-py2.7-linux-i686.egg',   '/usr/local/lib/python2.7/site-packages/RBTools-0.7.1-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/six-1.9.0-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/ReviewBoard-2.0.13-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/Whoosh-2.6.0-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/recaptcha_client-1.0.6-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/pytz-2014.10-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/python_memcached-1.53-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/python_dateutil-1.5-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/Pygments-2.0.2-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/paramiko-1.15.2-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/mimeparse-0.1.3-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/Markdown-2.4.1-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/docutils-0.12-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/django_haystack-2.3.1-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/Djblets-0.8.15-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/django_evolution-0.7.4-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/ecdsa-0.13-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/pycrypto-2.6.1-py2.7-linux-i686.egg',   '/usr/local/lib/python2.7/site-packages/pillowfight-0.2-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/feedparser-5.1.3-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/django_pipeline-1.3.27-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/futures-2.2.0-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/mod_wsgi-4.4.8-py2.7-linux-i686.egg',   '/usr/local/lib/python2.7/site-packages/django_lint-0.0.0-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/pylint-1.4.1-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/astroid-1.3.4-py2.7.egg',   '/usr/local/lib/python2.7/site-packages/logilab_common-0.63.2-py2.7.egg',   '/usr/local/lib/python27.zip',   '/usr/local/lib/python2.7',   '/usr/local/lib/python2.7/plat-linux2',   '/usr/local/lib/python2.7/lib-tk',   '/usr/local/lib/python2.7/lib-old',   '/usr/local/lib/python2.7/lib-dynload',   '/usr/local/lib/python2.7/site-packages']







 if 'audit_info_manage' in request.POST:  192         #fullname = Employee.objects.get(emp_id=request.POST['emp_id'])  193         audit_manage_key = request.POST.get('audit_info_getdata')  194         if audit_manage_key:  195             audit_manage_key = request.POST.get('audit_info_getdata')  196             if audit_manage_key:  197                 try:  198                     audit_info = EmployeeAuditInfo.objects.get(pk=audit_manage_key)  199                     SUCCESS_MESSAGE = 'Updated Status successfully'  200                 except EmployeeAuditInfo.DoesNotExist:  201                     audit_info = EmployeeAuditInfo()  202                     SUCCESS_MESSAGE = 'Disable an Employee successfully'  203  204             if audit_info:  205                 #form_emp_id = int(request.POST['emp_id'])  206                 employee = Employee.objects.get(emp_id=request.POST['emp_id'])  207                 employee.save  208                 audit_info = EmployeeAuditInfo()  209                 audit_info.emp_id = employee  210                 audit_info.status = request.POST['status']  211                 audit_info.updated_by = request.user  212                 audit_info.created_on = request.POST['created_on']  213                 audit_info.modified_on = request.POST['modified_on']  214                 audit_info.reason = request.POST['reason']  215                 audit_info.save()  




















On Thursday, September 18, 2008 at 11:05:02 PM UTC+5:30, kelvin pompey wrote:
Is there a way to modify the html for the admin form to display the image using the html img tag instead of having a link to the image?

On Thu, Sep 18, 2008 at 11:50 AM, Lisa Dusseault <lisa.dusseault@gmail.com> wrote:
I've seen the same problem with FileFields, so it's not just ImageFields.  I haven't figured it out yet.  I can make a link to the file work from the main UI, but I don't know how the admin constructs its link in an unmodified admin form.

Lisa


On Thu, Sep 18, 2008 at 5:17 AM, silk.odyssey <silkodyssey@gmail.com> wrote:

I am using an imagefield from the admin interface. I can upload images
without problems but when I click the link to view the image, I get
the following error.

invalid literal for int() with base 10: '1/photos/desktop.png'

Any idea what's wrong? I am using django 1.0.






--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8c1a23ab-6bf1-4d23-aeb8-6c450d0647ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment