django - TypeError: Error when calling the metaclass bases sequence item 2: expected string or Unicode, int found -


i have following models.py

from django.db import models import datetime  class build(models.model):     build_name = models.charfield(max_length=60)     description = models.charfield(max_length=140)     parts = models.manytomanyfield('part')      def __unicode__(self):         return self.build_name  class part(models.model):     name = models.charfield(max_length=70)     cost_usd = models.decimalfield(5, 2)     type_of = models.charfield(max_length=5)     supported_builds = models.manytomanyfield(build)      def __unicode__(self):          return self.name  class orderbuild(models.model):     parent = models.foreignkey(build)     custom_parts = models.manytomanyfield(part)  class pricecache(models.model):     price = models.decimalfield(4, 2)     time_fetched = models.datetimefield(default=datetime.datetime.now()) 

i've tried commenting each of lines 1 one , rerunning, , there no 1 line seems cause bug. time synced when commented out in model classes.

does know causing bug, , how can fix it?

check lines

cost_usd = models.decimalfield(5, 2) # ... price = models.decimalfield(4, 2) 

by modifying them to

cost_usd = models.decimalfield(max_digits=5, decimal_places=2) # ... price = models.decimalfield(max_digits=4, decimal_places=2) 

the signature of model fields like

field(verbose_name=none, name=none, ...) decimalfield(verbose_name=none, name=none, max_digits=none, decimal_places=none, **kwargs) 

thus code have verbose_name , name of fields incorrectly set integer numbers.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -