On Jan 24, 1:46 pm, Trevor Stanley <h...@balancingact.me.uk> wrote:
> Bruno
>
> I will take your advice and seek out some Python literature.  I did run
> through an online Python tutorial about a year ago.  I should probably
> go through it again as I may understand it more now.
>
> Thanks, even though your delivery is rather blunt - Trevor
>

It seems like the problem is that you're trying to do
fairly complex things in django when you don't
have good understanding of python. Simply
reading python tutorial will help but probably
won't be enough, I would recommend doing a
few small, simple projects in plain python to get
a good practical knowledge of how functions,
lists and dictionaries work.

In the above code, you apparently thought that
in line qft=ft(sum('percentage')) ,
percentage field will somehow be extracted from
ft and then summed. You should understand that
the line is equivalent to
mysum = sum('percentage')
qft = ft(mysum)

Then you'd certainly see that sum('percentage')
is trying to make a sum out of the string. Again,
this is a tidbit of basic python knowledge that
you have to have a perfect grip on before
doing the type of project that you have here.

It's ok to try things and run into errors. But you
have to have a better grasp on fundamentals
when you do that. In the above example, adding
a sum() call inside a call to ft and giving it a field
name as argument is as likely to work as doing

ft('percentage') # please sum

or

ft{'percentage':sum}

or a million of other things that won't work and
result in confusing errors.

Walk before you run and all that..  HTH, -ak

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

Reply via email to