Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Manipulator.save() not hitting the DB [RSS Feed]

#1 Nov. 3, 2005 19:06:26

K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Manipulator.save() not hitting the DB


I'm trying to use the manipulator framework to generate a multi-part
form. It's for an online shopping engine where the customer goes
through a few steps entering their shipping and credit card info, etc.

Anyways, I created some model classes, eg ContactInfo (phone #, email,
etc), Address and CreditCardInfo. Using the builtin manipulators and
formwrappers to present these variables to the user. When each form
was POSTed to the server, I was going to use the AddManipulator to
first validate the data (get_validation_errors()), and if that
succeeds, convert the form data into the representative Model object
and then store that object in the session dictionary. Unfortunately,
it seems the only method available in the Manipulator framework is
save() and that stores the variable first in the database. Is there a
way to convert the form data into django Model objects without saving
them to the db?

Offline

#2 Nov. 3, 2005 19:11:30

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Manipulator.save() not hitting the DB


On 11/3/05, Kevin <> wrote:
> Unfortunately,
> it seems the only method available in the Manipulator framework is
> save() and that stores the variable first in the database. Is there a
> way to convert the form data into django Model objects without saving
> them to the db?

There's no way to do this in the default (automatic) Manipulators, but
doing it on your own, with a custom manipulator, should be easy. Check
out the docs:http://www.djangoproject.com/documentation/forms/#custom-forms-and-manipulatorsAdrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#3 Nov. 3, 2005 19:53:41

K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Manipulator.save() not hitting the DB


The base class, Manipulator, just throws a NotImplementedException for
it's save() method. Is there a more concrete example I can view to see
how to override storing to the database.

PS. I'm converting an existing PHP site to django, it's so nice having
all these validation/admin stuff just "taken care of". Thanks for the
work & help.

Offline

  • Root
  • » Django
  • » Manipulator.save() not hitting the DB [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support