On Thu, 29 Dec 2005 17:57:45 -0800 cpburmester wrote:

> I see one reccommendation described at:
> 
> http://code.djangoproject.com/wiki/CookBookManipulatorWithPostpopulatedFields
> 
> but I'm trying to do the inverse - allow the update of only, say, one
> field and keep the rest the same whereas this example is preserving a
> few and updating the majority.
> 
> The analogy in SQL would be:
> 
> update tablename set foo="bar" where id=some_id;
> 
>  - i.e. only one field is changed, the rest are preserved.
> 
> It seems that in order to use a manipulator, I have to specify all the
> fields. This is very unweildy for what I'm trying to do.

I think the purpose of manipulators is to take the donkey work out
of updating multiple fields.  If it's only one field, then why bother
with the manipulator?  Just grab the object, read the request.POST data
for the one field, update the object and save it.
        myobject.foo = request.POST["foo"]
        myobject.save()

The disadvantage with this is you don't get the nice validation stuff
that manipulators do.  I'm not sure if there is a way to call the
validators directly.


Luke

-- 
"A man in love is incomplete until he is married. Then he is finished." 
-- Zsa Zsa Gabor, "Newsweek"

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

Reply via email to