Re: TypeError Exception Value: coercing to Unicode: need string or buffer, dict found

2012-05-23 Thread Waleria
It shows this line:

File "C:\simuladores\..\simuladores\detector\views.py" in pdf
  259. canvas.print_pdf(response, facecolor='w', edgecolor='w')
File "C:\Python26\Lib\site-packages\matplotlib\backend_bases.py" in
print_pdf
  1334. return pdf.print_pdf(*args, **kwargs)

In my code this line is: dir(canvas.print_pdf)
canvas.print_pdf(response, facecolor='w', edgecolor='w')

but I do not know about solving.

On 23 maio, 09:37, kenneth gonsalves  wrote:
> On Wed, 2012-05-23 at 05:16 -0700, Waleria wrote:
> > Exception Type: TypeError Exception Value: coercing to Unicode: need
> > string or buffer, dict found
>
> you have to find out where in the code the error is coming. Then you
> will find that you are passing a dict instead of a string.
> --
> regards
> Kenneth Gonsalves

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



TypeError Exception Value: coercing to Unicode: need string or buffer, dict found

2012-05-23 Thread Waleria
Hi,

Anyone know how to solve this error?

Exception Type: TypeError Exception Value: coercing to Unicode: need
string or buffer, dict found

Can you help me??

See mycode: http://dpaste.com/751460/

And see my Traceback: http://dpaste.com/750773/


Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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.



Re: Graphic and form in the same template

2010-10-26 Thread Waleria
I don't understand what you said.

Thanks

On 26 out, 12:19, Daniel Roseman  wrote:
> On Oct 26, 3:08 pm, Waleria  wrote:
>
> > I know that the execution of the function stops there, but i don't
> > know how do i resolve. I need to display the graphic generated and
> > just below the form.
>
> > Can you help me, please?
>
> > Thanks
>
> Well as far as I can tell, the generated graphic doesn't depend on the
> request or the form at all. So why does it need to be created in the
> same view as the form? It seems like you just need your template to
> contain a normal HTML image tag, whose `src` attribute is a URL that
> points to the gera_grafico function (or a wrapped version that returns
> the FigureCanvas).
> --
> DR.

-- 
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.



Re: Graphic and form in the same template

2010-10-26 Thread Waleria
I know that the execution of the function stops there, but i don't
know how do i resolve. I need to display the graphic generated and
just below the form.

Can you help me, please?

Thanks

On 26 out, 11:42, Daniel Roseman  wrote:
> On Oct 26, 2:17 pm, Waleria  wrote:
>
> > Hi all,
>
> > I have this code:http://pastebin.com/Ra1G7twn
>
> > I need to display the graphic generated and just below the form, now
> > the code only display the form. The image of graphic isn't displayed.
>
> > What could it be?
>
> > How do i resolve?
>
> > Thanks
>
> I don't understand what you are expecting to happen here. Line 22 is a
> return statement, and so execution of the function stops there.
> There's no way to get to the code in lines 29-34.
> --
> DR.

-- 
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.



Graphic and form in the same template

2010-10-26 Thread Waleria
Hi all,

I have this code: http://pastebin.com/Ra1G7twn

I need to display the graphic generated and just below the form, now
the code only display the form. The image of graphic isn't displayed.

What could it be?

How do i resolve?

Thanks

-- 
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.



Application hosting

2010-07-16 Thread Waleria
Hi all,


Well,

I will begin setting up a machine to host my
applications python / django. My questions are:

1º - Requeriments to configure this machine. My application is a form
where i enter with parameters, generate a image, .dat file and pdf
file and will have several internal and external accesses;

2º - Another thing that is leaving me with questions is the fact that
makes available for that machine will run several applications in
python /django, or application server is a python.

I need to know how much memory, HD. What setting do I need

-- 
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.



Generate image to pdf

2010-07-07 Thread Waleria
Hi all,

I'm trying generate a image to pdf. Well, is to convert a
Figure matplotlib's object to an image or object that can be
drawImage used in the canvas. See my code like this:

http://paste.pocoo.org/show/234628/

My urls.py:

urlpatterns = patterns('simuladores.detector.views',
(r'^grafico/$', 'envia_template'),
(r'^pdf/$', 'pdf'),
(r'^index/$', 'index'),

But returns the ERROR:

IOError at /pdf/

Cannot open resource "Figure(640x480)"
fileName=

Request Method: GET
Request URL: http://localhost:8000/pdf/
Exception Type: IOError
Exception Value: Cannot open resource "Figure(640x480)"
fileName=

Please help me

-- 
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.



Parameters

2010-06-29 Thread Waleria
Hi all,

I have the following code below and i need receive the parameters of
the index view: Sfase=[ ], Sserie=[ ], Sba=[ ], St=[ ] and f  to my
view draws_graph but i don't know.

Because if I pass the parameters as I am passing on draws_graph
view(line 68,69 and 70 - view draws_graph), it works by drawing the
image in the template but if I comment these lines does not work

look my code..how can I get these parameters index view?

http://paste.pocoo.org/show/231295/

-- 
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.



Generate image and send to template

2010-06-23 Thread Waleria
Hi all,

I need generate a image and send to template, but I'm not
getting ...see my code

http://paste.pocoo.org/show/OtwMsOEhe8c9b7jF0elw/

I'm not getting to understand the

def generate_graph (request):

-- 
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.



Re: Random

2010-06-22 Thread Waleria
my application doesn't use DBnot able to do this without using the
Random? ... without DB?

On 22 jun, 14:22, Javier Guerra Giraldez  wrote:
> On Tue, Jun 22, 2010 at 12:11 PM, Waleria  wrote:
> > I have a system that generate graphs and files .dat. However,  i'm
> > having a problem, when two people access the system simultaneously may
> > happen that the graph of a person to replace the second person, what
> > can I do to make it not happen?
>
> you have to get some way to keep both users separate.  one approach
> would be to create DB records for each task, and use the record ID as
> part of the file name.  another would be to use the session ID.
>
> --
> Javier

-- 
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.



Random

2010-06-22 Thread Waleria
Hello Guys,

I have a system that generate graphs and files .dat. However,  i'm
having a problem, when two people access the system simultaneously may
happen that the graph of a person to replace the second person, what
can I do to make it not happen?

-- 
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.



Re: fieldsets django

2010-06-21 Thread Waleria
I don't know  I'm wondering how to use the fieldsets.can you
help me...how to use the fieldsets...?

On 20 jun, 15:01, Francis Gulotta  wrote:
> You might want to look into a css solution.
>
> -Francis
>
> ---
> Francis Gulotta
> wiz...@roborooter.com
>
> On Fri, Jun 18, 2010 at 3:40 PM, Waléria Antunes David <
>
>
>
> waleriantu...@gmail.com> wrote:
> > I have a form with various fields and I need to split these fields so that
> > it looks like the image attached. I was reading about FIELDSETS but do not
> > know how to use.
>
> > --
> > 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.

-- 
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.



File - .dat

2010-06-16 Thread Waleria
Hello,

I need to leave a file tabbed, like this:

http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat

Following piece of my code that does this: - with Django

# -
# Import
# -
from django.shortcuts import get_object_or_404, render_to_response
from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.template import RequestContext
from django.core.urlresolvers import reverse
from simuladores.detector.forms import Fase
from django.template import loader, Context
from django.views.generic.simple import direct_to_template
from django.forms import forms, fields
from matplotlib import use
use('Agg')
from matplotlib.pyplot import plot, savefig, setp, figure, subplot
import csv
#from struct import pack
from pylab import *
import pylab
from decimal import Decimal
import math
import matplotlib.pyplot as plt

# 
# A view that to show the form
# 
def desenha_grafico(request):

if request.method == 'POST':
form = Fase(request.POST)
if form.is_valid():
f = xrange(3000,3400)

# 
# S, Sfase
# 

Sfase=[]


for v in f:
# ---
# Sfase
# ---
Sfase.append(form.cleaned_data['Sph']*(pow(v,2)/
pow(form.cleaned_data['df'],2)))



# ---
# Plot Graph
# ---
fig = plt.figure()
plt.subplots_adjust(hspace=0.4)
plt.subplots_adjust(wspace=0.4)
ax = plt.subplot(2,2,1)
ax.plot(f,Sfase)
leg = ax.legend(loc="left")

setp(ax.get_xticklabels(), fontsize=8.5)
setp(ax.get_yticklabels(), fontsize=8.5)
frame  = leg.get_frame()
frame.set_facecolor('white') # set the frame face color to
white

# matplotlib.text.Text instances
for t in leg.get_texts():
t.set_fontsize('9')
grid('TRUE')


savefig('C:\simuladores\detector\media\imagem.png')
writer = csv.writer(open('C:\simuladores\detector\media
\dados.dat','wb'))

writer.writerow(f)
writer.writerow(Sfase)

resultado = Fase()

# ---
# return to template
# ---
return render_to_response('gera_grafico.html',
  {'resultado': resultado},
  context_instance =
RequestContext(request))
#return render_to_response('soma.html', {'resultado':
resultado})
else:
form = Fase(request.POST)
return render_to_response('soma.html', {'form': form})

form=Fase()
return render_to_response('soma.html', {'form': form})



Following my code in the IDLE of Python


import numpy
import pylab
from pylab import *

x = arange(3000,3400)
y = -108*((x**2)/(3e14**2))

numpy.savetxt('C:\Documents and Settings\Web\dados.dat', (x,y))


However, my file dados.dat  out as follows in this link, yhis out in a
single line

http://paste.pocoo.org/show/226192/


As I viewthis as link: 
http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat

-- 
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.



Re: Arquivo .dat

2010-06-15 Thread Waleria
can anyone help me?

On 14 jun, 15:45, Waleria  wrote:
> I need to save the values of f in a columm and the values of Sfase in
> a other columm for de 
> exemple:http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat
>
> On 14 jun, 15:20, Waleria  wrote:
>
> > look my code:http://paste.pocoo.org/show/225383/
>
> > f is f = xrange(3000,3400)
> > and Sfase are the values of function ..for each value of "f"
> > against a value for "Sfase"
>
> > Dou you understand?
>
> > On 14 jun, 15:08, Daniel Roseman  wrote:
>
> > > On Jun 14, 5:05 pm, Waleria  wrote:
>
> > > > Hello,
>
> > > > I need to leave a file tabbed, like this:
>
> > > >http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat
>
> > > > Following piece of my code that does this:
>
> > > > savefig('C:\simuladores\detector\media\imagem.png')
> > > > writer = csv.writer(open('C:\simuladores\detector\media
> > > > \dados.dat','wb'))
> > > > for v1, v2 in pack(f, Sfase):
> > > >          texto_formato='%f\t\t%f' %(v1,v2)
> > > >          writer.writerow(texto_formato)
>
> > > > resultado = Fase()
>
> > > > But this error returns:
>
> > > > TypeError at /simulador/
>
> > > > Struct() argument 1 must be string, not xrange
>
> > > > Request Method:         POST
> > > > Request URL:    http://localhost:8000/simulador/
> > > > Exception Type:         TypeError
> > > > Exception Value:
>
> > > > Struct() argument 1 must be string, not xrange
>
> > > > Exception Location:     C:\simuladores\..\simuladores\detector\views.py
> > > > in desenha_grafico, line 158
>
> > > > in my code line 158 is this: for v1, v2 in pack(f, Sfase):
>
> > > What are f and Sfase, and why are you using Struct.pack (and why
> > > haven't you read the documentation for it)?
> > > --
> > > DR.

-- 
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.



Re: Arquivo .dat

2010-06-14 Thread Waleria
I need to save the values of f in a columm and the values of Sfase in
a other columm for de exemple: 
http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat

On 14 jun, 15:20, Waleria  wrote:
> look my code:http://paste.pocoo.org/show/225383/
>
> f is f = xrange(3000,3400)
> and Sfase are the values of function ..for each value of "f"
> against a value for "Sfase"
>
> Dou you understand?
>
> On 14 jun, 15:08, Daniel Roseman  wrote:
>
> > On Jun 14, 5:05 pm, Waleria  wrote:
>
> > > Hello,
>
> > > I need to leave a file tabbed, like this:
>
> > >http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat
>
> > > Following piece of my code that does this:
>
> > > savefig('C:\simuladores\detector\media\imagem.png')
> > > writer = csv.writer(open('C:\simuladores\detector\media
> > > \dados.dat','wb'))
> > > for v1, v2 in pack(f, Sfase):
> > >          texto_formato='%f\t\t%f' %(v1,v2)
> > >          writer.writerow(texto_formato)
>
> > > resultado = Fase()
>
> > > But this error returns:
>
> > > TypeError at /simulador/
>
> > > Struct() argument 1 must be string, not xrange
>
> > > Request Method:         POST
> > > Request URL:    http://localhost:8000/simulador/
> > > Exception Type:         TypeError
> > > Exception Value:
>
> > > Struct() argument 1 must be string, not xrange
>
> > > Exception Location:     C:\simuladores\..\simuladores\detector\views.py
> > > in desenha_grafico, line 158
>
> > > in my code line 158 is this: for v1, v2 in pack(f, Sfase):
>
> > What are f and Sfase, and why are you using Struct.pack (and why
> > haven't you read the documentation for it)?
> > --
> > DR.

-- 
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.



Re: Arquivo .dat

2010-06-14 Thread Waleria
look my code: http://paste.pocoo.org/show/225383/

f is f = xrange(3000,3400)
and Sfase are the values of function ..for each value of "f"
against a value for "Sfase"

Dou you understand?

On 14 jun, 15:08, Daniel Roseman  wrote:
> On Jun 14, 5:05 pm, Waleria  wrote:
>
>
>
> > Hello,
>
> > I need to leave a file tabbed, like this:
>
> >http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat
>
> > Following piece of my code that does this:
>
> > savefig('C:\simuladores\detector\media\imagem.png')
> > writer = csv.writer(open('C:\simuladores\detector\media
> > \dados.dat','wb'))
> > for v1, v2 in pack(f, Sfase):
> >          texto_formato='%f\t\t%f' %(v1,v2)
> >          writer.writerow(texto_formato)
>
> > resultado = Fase()
>
> > But this error returns:
>
> > TypeError at /simulador/
>
> > Struct() argument 1 must be string, not xrange
>
> > Request Method:         POST
> > Request URL:    http://localhost:8000/simulador/
> > Exception Type:         TypeError
> > Exception Value:
>
> > Struct() argument 1 must be string, not xrange
>
> > Exception Location:     C:\simuladores\..\simuladores\detector\views.py
> > in desenha_grafico, line 158
>
> > in my code line 158 is this: for v1, v2 in pack(f, Sfase):
>
> What are f and Sfase, and why are you using Struct.pack (and why
> haven't you read the documentation for it)?
> --
> DR.

-- 
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.



File .data

2010-06-14 Thread Waleria
Hello,

I need to leave a file tabbed, like this:

http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat

Following piece of my code that does this:

savefig('C:\simuladores\detector\media\imagem.png')
writer = csv.writer(open('C:\simuladores\detector\media
\dados.dat','wb'))
for v1, v2 in pack(f, Sfase):
 texto_formato='%f\t\t%f' %(v1,v2)
 writer.writerow(texto_formato)

resultado = Fase()

But this error returns:

TypeError at /simulador/

Struct() argument 1 must be string, not xrange

Request Method: POST
Exception Type: TypeError
Exception Value:

Struct() argument 1 must be string, not xrange

Exception Location: C:\simuladores\..\simuladores\detector
\views.py
in desenha_grafico, line 158

in my code line 158 is this: for v1, v2 in pack(f, Sfase):

-- 
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.



Arquivo .dat

2010-06-14 Thread Waleria
Hello,

I need to leave a file tabbed, like this:

http://www.srl.caltech.edu/~shane/sensitivity/asteroids/scg_8564.dat

Following piece of my code that does this:

savefig('C:\simuladores\detector\media\imagem.png')
writer = csv.writer(open('C:\simuladores\detector\media
\dados.dat','wb'))
for v1, v2 in pack(f, Sfase):
 texto_formato='%f\t\t%f' %(v1,v2)
 writer.writerow(texto_formato)

resultado = Fase()

But this error returns:

TypeError at /simulador/

Struct() argument 1 must be string, not xrange

Request Method: POST
Request URL:http://localhost:8000/simulador/
Exception Type: TypeError
Exception Value:

Struct() argument 1 must be string, not xrange

Exception Location: C:\simuladores\..\simuladores\detector\views.py
in desenha_grafico, line 158

in my code line 158 is this: for v1, v2 in pack(f, Sfase):

-- 
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.



Re: error: unsupported operand type(s) for *: 'Decimal' and 'float'

2010-06-11 Thread Waleria
Oki converted this (i.e. pow(2,2) and pow(2*math.pi*v,2) to
Decimalsmy 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  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
> dih0...@gmail.com
>
> On Jun 11, 6:58 am, Waleria  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  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  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 errorfallows
> > > > 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 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.



Re: error: unsupported operand type(s) for *: 'Decimal' and 'float'

2010-06-11 Thread Waleria
Dan,

Do you speak for me to do this? for the example...

http://paste.pocoo.org/show/224233

On 10 jun, 16:51, felix  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  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 errorfallows
> > 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 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.



error: unsupported operand type(s) for *: 'Decimal' and 'float'

2010-06-10 Thread Waleria
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 errorfallows
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 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.



Re: parameters directly in the function

2010-06-10 Thread Waleria
Well.i got this values of a form but i thank you very
much...because i got resolve this problem

Thank you

On 10 jun, 15:53, Daniel Roseman  wrote:
> On Jun 10, 6:13 pm, Waleria  wrote:
>
> > Hello!!!
>
> > I'm Walériai have a question about a functionsi have a
> > function bellow:
>
> > y.append(pow(form.cleaned_data['Pinc'],2)/(2*(pow(2*pi*v,
> > 2)))*((pow(2,2)*pow(form.cleaned_data['Qe'],2)))/
> > (pow(form.cleaned_data['fp'],2))*(pow(form.cleaned_data['df'],2)))
>
> > I need to pass this parameter (2 * pi * x) directly on the function
> > but displays an error: unsupported operand type(s) for /: 'Decimal'
> > and 'float'
>
> > As i do?
>
> That's not a function, that's a single line of incredibly (and
> unnecessarily) complex code.
>
> Where are you passing the value to? What is x? What is pi in this
> instance? How are you passing these values? Where exactly is the error
> occurring (if you split this line up into multiple lines, the error
> would point to the exact bit with the problem)?
> --
> DR.

-- 
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.



parameters directly in the function

2010-06-10 Thread Waleria
Hello!!!

I'm Walériai have a question about a functionsi have a
function bellow:

y.append(pow(form.cleaned_data['Pinc'],2)/(2*(pow(2*pi*v,
2)))*((pow(2,2)*pow(form.cleaned_data['Qe'],2)))/
(pow(form.cleaned_data['fp'],2))*(pow(form.cleaned_data['df'],2)))

I need to pass this parameter (2 * pi * x) directly on the function
but displays an error: unsupported operand type(s) for /: 'Decimal'
and 'float'

As i do?

-- 
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.