python - django - How to set default value for DecimalField in django 1.3? -


one of model's field looks this:

total_amount = models.decimalfield(max_digits=20,decimal_places=4,default=decimal('0.0000')) 

but when run command python manage.py syncdb, shows error:

nameerror: name 'decimal' not defined 

i have imported from django.db import models, need import other thing too?
please help!

you need import decimal.

from decimal import decimal 

Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -