Thursday, March 28, 2013

Re: models.DecimalField causing weird Attribute/Type errors

Resolved, the __unicode__ did not returned unicode object.

Dne pátek, 22. března 2013 10:50:08 UTC+1 Tomas Pelka napsal(a):
Hi all

I'm trying to make one of my first apps running but always getting weird errors Attribute/Type for models.DecimalField as well as for DateField.

In case I want to store anything into sqlitedb I always get:

TypeError: 'datetime.datetime' object is unsubscriptable, same for Decimal/int

For the case I already have any records in db and just want to display them in admin interface:

Request Method: GET
Request URL: http://127.0.0.1:8000/admin/energie/el/
Django Version: 1.5
Exception Type: AttributeError
Exception Value:
'Decimal' object has no attribute 'encode'
Exception Location: /usr/lib/python2.6/site-packages/Django-1.5-py2.6.egg/django/db/models/base.py in __str__, line 433
Python Executable: /usr/bin/python
Python Version: 2.6.6
Python Path:
['/home/tpelka/workspace/energie/wsgi/energie',   '/usr/lib/python2.6/site-packages/ropemode-0.2-py2.6.egg',   '/usr/lib/python2.6/site-packages/rope-0.9.4-py2.6.egg',   '/usr/lib/python2.6/site-packages/ropevim-0.4-py2.6.egg',   '/usr/lib/python2.6/site-packages/mozmill-1.5.20-py2.6.egg',   '/usr/lib/python2.6/site-packages/ManifestDestiny-0.2.2-py2.6.egg',   '/usr/lib/python2.6/site-packages/mozrunner-2.5.14-py2.6.egg',   '/usr/lib/python2.6/site-packages/jsbridge-2.4.16-py2.6.egg',   '/usr/lib/python2.6/site-packages/Django-1.5-py2.6.egg',   '/usr/share/qa-tools/python-modules',   '/usr/lib64/python26.zip',   '/usr/lib64/python2.6',   '/usr/lib64/python2.6/plat-linux2',   '/usr/lib64/python2.6/lib-tk',   '/usr/lib64/python2.6/lib-old',   '/usr/lib64/python2.6/lib-dynload',   '/usr/lib64/python2.6/site-packages',   '/usr/lib64/python2.6/site-packages/Numeric',   '/usr/lib64/python2.6/site-packages/gst-0.10',   '/usr/lib64/python2.6/site-packages/gtk-2.0',   '/usr/lib64/python2.6/site-packages/webkit-1.0',   '/usr/lib/python2.6/site-packages',   '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info']

Attaching models,py, admin.py and settings.py

Dne pátek, 22. března 2013 10:50:08 UTC+1 Tomas Pelka napsal(a):
Hi all

I'm trying to make one of my first apps running but always getting weird errors Attribute/Type for models.DecimalField as well as for DateField.

In case I want to store anything into sqlitedb I always get:

TypeError: 'datetime.datetime' object is unsubscriptable, same for Decimal/int

For the case I already have any records in db and just want to display them in admin interface:

Request Method: GET
Request URL: http://127.0.0.1:8000/admin/energie/el/
Django Version: 1.5
Exception Type: AttributeError
Exception Value:
'Decimal' object has no attribute 'encode'
Exception Location: /usr/lib/python2.6/site-packages/Django-1.5-py2.6.egg/django/db/models/base.py in __str__, line 433
Python Executable: /usr/bin/python
Python Version: 2.6.6
Python Path:
['/home/tpelka/workspace/energie/wsgi/energie',   '/usr/lib/python2.6/site-packages/ropemode-0.2-py2.6.egg',   '/usr/lib/python2.6/site-packages/rope-0.9.4-py2.6.egg',   '/usr/lib/python2.6/site-packages/ropevim-0.4-py2.6.egg',   '/usr/lib/python2.6/site-packages/mozmill-1.5.20-py2.6.egg',   '/usr/lib/python2.6/site-packages/ManifestDestiny-0.2.2-py2.6.egg',   '/usr/lib/python2.6/site-packages/mozrunner-2.5.14-py2.6.egg',   '/usr/lib/python2.6/site-packages/jsbridge-2.4.16-py2.6.egg',   '/usr/lib/python2.6/site-packages/Django-1.5-py2.6.egg',   '/usr/share/qa-tools/python-modules',   '/usr/lib64/python26.zip',   '/usr/lib64/python2.6',   '/usr/lib64/python2.6/plat-linux2',   '/usr/lib64/python2.6/lib-tk',   '/usr/lib64/python2.6/lib-old',   '/usr/lib64/python2.6/lib-dynload',   '/usr/lib64/python2.6/site-packages',   '/usr/lib64/python2.6/site-packages/Numeric',   '/usr/lib64/python2.6/site-packages/gst-0.10',   '/usr/lib64/python2.6/site-packages/gtk-2.0',   '/usr/lib64/python2.6/site-packages/webkit-1.0',   '/usr/lib/python2.6/site-packages',   '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info']

Attaching models,py, admin.py and settings.py

Dne pátek, 22. března 2013 10:50:08 UTC+1 Tomas Pelka napsal(a):
Hi all

I'm trying to make one of my first apps running but always getting weird errors Attribute/Type for models.DecimalField as well as for DateField.

In case I want to store anything into sqlitedb I always get:

TypeError: 'datetime.datetime' object is unsubscriptable, same for Decimal/int

For the case I already have any records in db and just want to display them in admin interface:

Request Method: GET
Request URL: http://127.0.0.1:8000/admin/energie/el/
Django Version: 1.5
Exception Type: AttributeError
Exception Value:
'Decimal' object has no attribute 'encode'
Exception Location: /usr/lib/python2.6/site-packages/Django-1.5-py2.6.egg/django/db/models/base.py in __str__, line 433
Python Executable: /usr/bin/python
Python Version: 2.6.6
Python Path:
['/home/tpelka/workspace/energie/wsgi/energie',   '/usr/lib/python2.6/site-packages/ropemode-0.2-py2.6.egg',   '/usr/lib/python2.6/site-packages/rope-0.9.4-py2.6.egg',   '/usr/lib/python2.6/site-packages/ropevim-0.4-py2.6.egg',   '/usr/lib/python2.6/site-packages/mozmill-1.5.20-py2.6.egg',   '/usr/lib/python2.6/site-packages/ManifestDestiny-0.2.2-py2.6.egg',   '/usr/lib/python2.6/site-packages/mozrunner-2.5.14-py2.6.egg',   '/usr/lib/python2.6/site-packages/jsbridge-2.4.16-py2.6.egg',   '/usr/lib/python2.6/site-packages/Django-1.5-py2.6.egg',   '/usr/share/qa-tools/python-modules',   '/usr/lib64/python26.zip',   '/usr/lib64/python2.6',   '/usr/lib64/python2.6/plat-linux2',   '/usr/lib64/python2.6/lib-tk',   '/usr/lib64/python2.6/lib-old',   '/usr/lib64/python2.6/lib-dynload',   '/usr/lib64/python2.6/site-packages',   '/usr/lib64/python2.6/site-packages/Numeric',   '/usr/lib64/python2.6/site-packages/gst-0.10',   '/usr/lib64/python2.6/site-packages/gtk-2.0',   '/usr/lib64/python2.6/site-packages/webkit-1.0',   '/usr/lib/python2.6/site-packages',   '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info']

Attaching models,py, admin.py and settings.py

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment