Thank you for responding, this is a vexing problem.
I know the urs.py is fine, as the the form html code I posted
is part of an .html, largely static html, which renders to the screen fine.
The form fields are also showing up in the rendered page, and numbers can be
entered, when the submit button is clicked I get the exception

Did I not understand your question, I am new at this.



On Mon, Mar 19, 2012 at 12:54 PM, Joel Goldstick
<joel.goldst...@gmail.com>wrote:

> On Mon, Mar 19, 2012 at 11:41 AM, bolivar4 <tmn...@gmail.com> wrote:
> > Want to present users a form in which numbers are entered, then
> manipulated
> > in a view and a calculated value is returned to the screen.
> > After looking in the the Django book around the net this is what I have
> > come, (it doesn't work) shows below.  So far, the three fields setup in
> > forms.py render to the secreen, that is all I'm getting.
> >
> >
> >
> > I am getting this error in the django 404 exception page: "unsupported
> > operand type(s) for *: 'NoneType' and 'NoneType'"
> >
> >
> > It is purposely a  simple exercise, more interested  in technique of
> doing
> > this so, I know this can be done in javascript, but I want to do this
> with
> > python/django.
> > Thank you to anyone who can help me out, this has been a problem all
> > weekend.
> >
> > forms.py:
> >
> > from django import forms
> >
> > class FinanceTable(forms.Form):
> >        capital = forms.IntegerField(required=False)
> >        tax_rate = forms.DecimalField(required=False)
> >        useage = forms.IntegerField(required=False)
> >
> > views.py:
> >
> > from django.shortcuts import render_to_response
> >
> > def  calculation(request):
> >        """view that sets up form calculation"""
> >        if request.method == 'POST':
> >             form  = FinanceTable(request.POST)
> >             if form.is_valid():
> >                  capital = form.cleaned_data['capital']
> >                   tax_rate = form.cleaned_data['tax_rate']
> >                   useage = form.cleaned_data['capital'] *
> > form.cleaned_data['tax_rate']
> >                   response_dict = {'capital' : capital, 'tax_rate'  :
> > tax_rate, 'useage' : useage}
> >                   return render_to_response('focus_areas.html',
> > response_dict)
> >         else:
> >               form = FinanceTable(
> >                              initial={'capital' : 1000, tax_rate : .07}
> >                )
> >         return render_to_response('focus_areas.html', {'form' : form})
> >
> >
> > html in template:
> >           <form action="" method= "" method="post">
> >                   <table>
> >                           {{ form.as_table }}
> >                   </table>
> >                   <input type="submit" value = "Submit"/>
> >           </form>
> >
> >
> > Any help ios much appreciated.
>
> What does your urls.py file look like.  If you are getting 404 then it
> may not be finding your view.
> --
> Joel Goldstick
>
> --
> 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.
>
>

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