I change the floatField to DecimalField and the error also out show:
And from django debug information I can't location which field resulting
this error!!

TypeError at /admin/main/myitem/add/


'Decimal' object is not callable

 Request Method:POST Request URL:
http://localhost:8000/admin/main/myitem/add/ Django Version:1.3 Exception
Type:TypeError Exception Value:


'Decimal' object is not callable

 Exception 
Location:C:\Python26\lib\site-packages\django\contrib\admin\options.py
in save_model, line 665 Python Executable:C:\Python26\python.exe Python
Version:2.6.6 Python Path:


['D:\\eclipse\\carveout\\d1d2d3\\src\\d1d2d3',
 'C:\\Python26\\lib\\site-packages\\markdown-2.0.3-py2.6-win32.egg',
 'C:\\Python26\\lib\\site-packages\\html5lib-0.90-py2.6.egg',
 'C:\\Python26\\lib\\site-packages\\cheetah-2.4.4-py2.6-win32.egg',
 'C:\\Python26\\lib\\site-packages\\tenjin-1.0.2-py2.6.egg',
 'C:\\Python26\\lib\\site-packages\\tornado-1.2.1-py2.6.egg',
 'C:\\Python26\\lib\\site-packages\\transifex-1.0.0-py2.6.egg',
 'C:\\Python26\\lib\\site-packages\\python_magic-0.4.0-py2.6.egg',
 'C:\\Python26\\lib\\site-packages\\pygooglechart-0.3.0-py2.6.egg',
 'C:\\Python26\\lib\\site-packages\\django_addons-0.6.4-py2.6.egg',
 'C:\\Python26\\lib\\site-packages\\feedparser-5.0.1-py2.6.egg',
 'C:\\WINDOWS\\system32\\python26.zip',
 'C:\\Python26\\DLLs',
 'C:\\Python26\\lib',
 'C:\\Python26\\lib\\plat-win',
 'C:\\Python26\\lib\\lib-tk',
 'C:\\Python26',
 'C:\\Python26\\lib\\site-packages',
 'C:\\Python26\\lib\\site-packages\\PIL']

 Server time:Fri, 20 May 2011 00:32:12 +0800
2011/5/15 Karen Tracey <[email protected]>

> On Sat, May 14, 2011 at 9:10 PM, Korobase <[email protected]> wrote:
>
>>
>>
>> 2011/5/15 Andy McKay <[email protected]>
>>
>>>
>>> > Exception Type: TypeError at /admin/main/learndjango/add/
>>> > Exception Value: 'float' object is not callable
>>>
>>>
>>> Please paste your model that is having the problem.
>>>
>>
>> class MyItem(models.Model):
>>     title=models.CharField(max_length=1024)
>>     description=models.CharField(max_length=1024)
>>     price=models.FloatField(default=0.0)
>>     time=models.DateTimeField()
>>     name=models.CharField(max_length=256)
>>     detail=models.CharField(max_length=1024)
>>     address_city=models.CharField(max_length=36)
>>     address_area=models.CharField(max_length=36)
>>
>>
>>     def __unicode__(self):
>>         return self.title
>>
>> and the ModelAdmin:
>>
>> class MyItemAdmin(admin.ModelAdmin):
>>     list_display=('name','title','price','address_city',)
>>
>> admin.site.register(MyItem, MyItemAdmin)
>>
>>
>>
> The traceback indicates that the new object being added is not an instance
> of MyItem, but rather a simple float. How that has happened is a mystery; it
> is not due to anything you have posted so far. If you cut-and-paste just the
> model and model admin definitions you show here into a new 1.3 project, the
> admin works fine to add items. There is something more to your code that you
> have not shown yet that is causing the problem. Really, Django can insert
> float data into a MySQL table (although as Andy notes, using a float field
> for something named "price" is likely really really really not what you want
> to be doing.
>
> Karen
> --
> http://tracey.org/kmt/
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>



--

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to