Ok....i converted this (i.e. pow(2,2) and pow(2*math.pi*v,2) to Decimals....my graph was plotted correctly.....however...i haven't split that giant line of code a few separte calculations......do you think best to do this?
On 11 jun, 09:13, Dan Harris <[email protected]> wrote: > That looks ok from a code readability point of view, however you will > still need to cast the form values to float or cast the float values > (i.e. pow(2,2) and pow(2*math.pi*v,2) to Decimals otherwise will you > will get an UnsupportedOperation exception. > > Dan Harris > [email protected] > > On Jun 11, 6:58 am, Waleria <[email protected]> wrote: > > > Dan, > > > Do you speak for me to do this? for the example... > > >http://paste.pocoo.org/show/224233 > > > On 10 jun, 16:51, felix <[email protected]> wrote: > > > > use > > > > float( form.cleaned_data['a'] ) > > > > etc > > > > also, when retreiving the field from the db it will be a Decimal > > > object and needs to be converted to do math with it > > > > on_sale = float(myObj.price) * 0.9 > > > > On Jun 10, 9:22 pm, Waleria <[email protected]> wrote: > > > > > Hello.. > > > > > I again.....now my problem is: > > > > > I have the function following:http://paste.pocoo.org/show/224041/ > > > > > These values i get of a form...however returns me an error....fallows > > > > below the error > > > > > Exception Type: TypeError > > > > Exception Value: unsupported operand type(s) for *: 'Decimal' and > > > > 'float' > > > > > Exception Location: C:\simuladores\..\simuladores\detector\views.py in > > > > graph, line 32 -- 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.

