On Wed, Oct 17, 2012 at 4:26 AM, Michał Nowotka <mmm...@gmail.com> wrote: > Currently I'm working with some oracle legacy db which I would like to > access using django ORM. > I have a column of type NUMERIC (without precision and scale) and all > possible values are kept there (for example, 65, 2.3, 0.0000000050000) > After running inspectdb django suggested that this column should be of type > models.DecimalField(unique= True, null=True, max_digits=0, > decimal_places=-127, blank=True) but this makes little sense since I'm > getting an error when trying to do syncdb from this model: > > Error: One or more models did not validate: DecimalFields require a > "decimal_places" attribute that is a non-negative integer. > DecimalFields require a "max_digits" attribute that is a positive integer. > > Do you know what type in model will map to NUMBER in oracle?
There is none. The proper type would be a floating-point DecimalField, but Django doesn't allow that as the decimal_places attribute is required. I'm not really sure why that is; maybe the requirement could be relaxed? If you don't need a lot of precision, then you could probably get away with using a FloatField. Otherwise you might want consider creating a custom field that looks like a FloatField but uses decimals instead of floats. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.