Maybe another way to reply to your question is to break down how it would work normally.
There are two sides of this question - the server side and the client side.

In general client side stuff is done in javascript.
Server side requests are done in python.

So you have to decide where you want this to happen. If you chose the server side realize that a round trip has to occur. This can be done and was done often but not normally used when dealing with direct user input (javascript is used) on the client side (in the browser). You can in fact create a button that retrieves the data (executes a view function) and then returns a new view. But that is very old school and normally not used. You might want to look at how the django forms works under the hood and use similar code.

That said, the above is not the norm of today. Within your template you add div id's that relate to javascript code. When the action occurs the javascript is run (all on the client side) saving a round trip. Today's javascript is able to retrieve data (execute a python function via a view), display data, insert new objects, etc.. So of course most use the best tool for the job.

Johnf

On 03/20/2015 10:32 AM, VMD wrote:

On Friday, March 20, 2015 at 11:09:57 AM UTC-6, David Gleba wrote:


    You don't actually need python or django to get form input and do
    something with the input.


My function is not as simple as adding two numbers and for various reasons I am not interested in using Javascript. I just used myadder(x,y) as an example.




    On Friday, March 20, 2015 at 12:03:51 PM UTC-4, VMD wrote:

        On Friday, March 20, 2015 at 9:58:23 AM UTC-6, David Gleba wrote:

            Does part 3 of the tutorial cover how to make a form, get
            the values without storing them in a database, perform the
            arithmetic and then display the result? I didn't see that
            in there.

        I don't what to store them in a database. Just do the
        calculation. Is this explained in the tutorial?

        I have been sick = brain not working well. maybe I'll get this
        figured out today or actually do the whole tutorial.

        VMD


            On Thursday, March 19, 2015 at 11:58:14 AM UTC-4, Andrew
            Farrell wrote:

                The other commenters are right that reading the
                tutorial is a good use of your time.
                https://docs.djangoproject.com/en/1.7/intro/tutorial03/ 
<https://docs.djangoproject.com/en/1.7/intro/tutorial03/>
                is the section relevant to your question.

                On Thu, Mar 19, 2015 at 10:39 AM, Javier Guerra
                Giraldez <jav...@guerrag.com> wrote:

                    On Wed, Mar 18, 2015 at 9:41 PM, VMD
                    <vin...@vincentdavis.com> wrote:
                    > I have skimmed the tutorial and didn't find
                    (notice) the answer. Why not
                    > point me to an answer to my question?


                    that's exactly the point.  your question assumes
                    Django works in some
                    specific way, and there should be a simple answer
                    for a simple need.

                    but i don't think you assumptions are correct, if
                    you knew how Django
                    (and frameworks in general) work, your question
                    might be very
                    different, and the answer much simpler and better
                    in general.

                    really, doing the tutorial is a very good
                    investment of your time.


                    --
                    Javier

                    --
                    You received this message because you are
                    subscribed to the Google Groups "Django users" group.
                    To unsubscribe from this group and stop receiving
                    emails from it, send an email to
                    django-users...@googlegroups.com.
                    To post to this group, send email to
                    django...@googlegroups.com.
                    Visit this group at
                    http://groups.google.com/group/django-users
                    <http://groups.google.com/group/django-users>.
                    To view this discussion on the web visit
                    
https://groups.google.com/d/msgid/django-users/CAFkDaoQ0MOT57JCKfTjxWn6CkypeP2POm%3DF90Vn%3DF88dYDDQdg%40mail.gmail.com
                    
<https://groups.google.com/d/msgid/django-users/CAFkDaoQ0MOT57JCKfTjxWn6CkypeP2POm%3DF90Vn%3DF88dYDDQdg%40mail.gmail.com>.
                    For more options, visit
                    https://groups.google.com/d/optout
                    <https://groups.google.com/d/optout>.


--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com <mailto:django-users+unsubscr...@googlegroups.com>. To post to this group, send email to django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0fb52afc-17ec-4301-add2-85fc962f73b4%40googlegroups.com <https://groups.google.com/d/msgid/django-users/0fb52afc-17ec-4301-add2-85fc962f73b4%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/550C69C3.2030605%40jfcomputer.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to