Hello Karen,

Thanks for your reply, i checked the code from the ticket and it was
indeed already changed in the current version.
The specs of the system i',m using are;

Python 2.4.3
Django 1.1.1 final
Database Postgresql
Interface postgresql_psycopg2

The problem i'm having is with the following model class with the
field value:

class Measurement(models.Model):
        measurement_id = models.AutoField("Measurement
ID",primary_key=True)
        value = models.DecimalField(max_digits=10,decimal_places=5)
        date = models.DateField()
        assay_ontology = models.ForeignKey(Assay_Ontology)
        parameter = models.ForeignKey(Parameter)
        measurement_factor = models.ForeignKey(Measurement_Factor)
        batch = models.ForeignKey(Batch)

So when i do the following everything works like it should.

m =
Measurement(value=34555,date=date,assay_ontology=ao,parameter=p,measurement_factor=mf,batch=b)
m.save()

But when i add another digit to the value it gives me the following
error
m =
Measurement(value=345556,date=date,assay_ontology=ao,parameter=p,measurement_factor=mf,batch=b)
m.save()

Traceback (most recent call last):
  File "<console>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/django/db/models/base.py",
line 410, in save
    self.save_base(force_insert=force_insert,
force_update=force_update)
  File "/usr/lib/python2.4/site-packages/django/db/models/base.py",
line 483, in save_base
    values = [(f, f.get_db_prep_save(raw and getattr(self, f.attname)
or f.pre_save(self, True))) for f in meta.local_fields if not
isinstance(f, AutoField)]
  File "/usr/lib/python2.4/site-packages/django/db/models/fields/
__init__.py", line 625, in get_db_prep_save
    self.max_digits, self.decimal_places)
  File "/usr/lib/python2.4/site-packages/django/db/backends/
__init__.py", line 404, in value_to_db_decimal
    return util.format_number(value, max_digits, decimal_places)
  File "/usr/lib/python2.4/site-packages/django/db/backends/util.py",
line 130, in format_number
    return u'%s' % str(value.quantize(decimal.Decimal(".1") **
decimal_places, context=context))
  File "/usr/lib/python2.4/decimal.py", line 1824, in quantize
    return self._rescale(exp._exp, rounding, context, watchexp)
  File "/usr/lib/python2.4/decimal.py", line 1870, in _rescale
    return context._raise_error(InvalidOperation, 'Rescale > prec')
  File "/usr/lib/python2.4/decimal.py", line 2267, in _raise_error
    raise error, explanation
InvalidOperation: Rescale > prec

I tried to find out what was going wrong and deleted the complete
table from the database and did a sycdb with a larger max_digits and
decimal_places value but that wouldn't help.

i did some further checking on the database, and it seems that there
is a database problem. When i insert the same values as described
above i also get an error stating the following:

insert into ratstream_measurement
values('1143','345556','2008/12/12','1','1','1','5');
ERROR:  numeric field overflow
DETAIL:  A field with precision 20, scale 15 must round to an absolute
value less than 10^5.

It seems something went wrong with the syncdb but i can't figure out
what, does anyone know what i'm doing wrong and can assist me helping
to fix the problem.

thanks in advance,

Richard



On May 11, 4:51 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Tue, May 11, 2010 at 9:49 AM, mendes.rich...@gmail.com <
>
>
>
>
>
> mendes...@gmail.com> wrote:
> > On our production server we are running the last official release
> > 1.1.1,
> > When i started uploading big decimal values i ran into trouble and
> > came across a ticket which described the error.
>
> > This was ticket 10692 and it was solved.
>
> > Unfortunately i couldn't track down which files should be replaced by
> > the altered code from the ticket.
> > Could anyone help me out and explain me how this normally works
> > outside the svn repository, so which files should i replace and where
> > can i find the altered code for those parts.
>
> > your help would be greatly appreciated,
>
> Ticket #10692:http://code.djangoproject.com/ticket/10692
>
> includes comments linking to the changesets where it was fixed, for example
> on trunk:
>
> http://code.djangoproject.com/changeset/10545
>
> shows the files and exact changes that were made.
>
> Note however, this ticket was fixed in trunk and the 1.0.X branch, which
> implies that the fix already exists in the 1.1 (and all subsequent)
> releases. The changes include a test of the problem that was fixed, and that
> tests passes in 1.1.1 and current trunk. Thus you should not be seeing this
> problem if you are running 1.1.1.
>
> Perhaps if you described exactly what problem you are seeing, including the
> version of Python you are running, someone could help in figuring out what
> is going on.
>
> 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 django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://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 django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to