Tuesday, January 22, 2013

Re: saving get objects to models

Thanks, for this help

On Tue, Jan 22, 2013 at 9:34 PM, Bill Freeman <ke1g.nh@gmail.com> wrote:
> Forgive me if I am not being direct, but I'm not sure I understand your
> question.
You understand the problem very well.

> For the python statement that you include in your question to work, the
> following must be true:
>
> 1. There must be a query parameter on the url named "material". e.g.;
> http://localhost:8000/myview/?material=admantium
> (Usually this would be provided using a form html tag, plus an input or
> select tag with name='material'.)
I have query parameter "material" in the url.

> 2. There must not be multiple material query parameters named "material" (or
> only the last will be used).


> 3. There must already be a row in the database's table for the Material
> model whose name field matches the value of the query ("admantium" in the
> case of the url in point #1), and only one row with that name. (The row
> will be fetched from the database, and the values of its fields will be used
> to initialize attributes of the python class instance called 'material' in
> your sample.)
Yes, there is a row present in the database whose name field matches
to the value of query.

> None of this is what is known as "save"ing in the context of Django. "save"
> is the transfer of data from the python class instance back to the database.
> If this is truly what you wish to do, modifying your existing row, you
> would, after the statement you provided, assign new values to one or more
> of instance's attributes (e.g.; material.color = 'pink'), and then call
> material.save().
This is the thing i am asking for, i am unable to save the context of
Django. I used the logic given by you but it did not worked. How will
i save the value of material in the database name field.

--
Satinderpal Singh
http://satindergoraya.blogspot.in/
http://satindergoraya91.blogspot.in/

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment