Storing several automated session variables from a form

I want to store data from a form which can be filled up many times in different session variables each time. I want to know how many variables i can set in sessions, i’ve been trying to do it and i can not set more than 2.
The thing is i have an orders model wich is rendered in a form and a customer can create several forms for that model.
But i don’t want to save them to the DB untill the order is accepted by the rider who’s going to deliver them.
So i would like a way to automate the process of creating sessions variables using a view according if a given variable already exists or not.
Let’s say:
The user fills out the form the first time:

the user fills out the form again:

and so on…
So after he finishes he selects a rider to deliver all the given orders, once this rider accepts the orders, i save all the info to the db.

The more i think about it, maybe the best way could be to save each order to the db and i if the rider rejects it just delete it?

I would appreciate your help.


Note that according to the sessions docs:

By default, Django stores sessions in your database…

So you’re already writing data to the database, just in an “unstructured” format.

Yes, overall you’re going to be a lot better off just assembling this data in your models. (You might want to have your base class implement something like an “in progress” field to specify whether or not the data is complete / accepted.) It’s going to end up saving you a lot of work in the long run.

1 Like

Thanks a lot for the quick reply!! It really helps me with the project. Have a nice day.