Reputation: 840
Is there a 'convenient' way to pass generic, dynamically created objects from one view as arguments to another view? As far as I can tell from the documentation, only strings can be passed.
I was thinking of two work arounds:
Maybe I miss something? Or if not, does anyone has an opinion on the workarounds?
Upvotes: 0
Views: 1833
Reputation: 599470
Rather than passing it to the view as a string, you could save it in the session in the first view, and pick it up from there in the second. The session should be able to accept your raw object, but potentially you might need to explicitly serialize it first.
Upvotes: 1
Reputation: 938
As far as I can tell, you can pass a django model instance to another view. Python will allow you to take any object instance as an argument. Views certainly aren't limited to strings (you can definitely pass ints, tuples, lists, dictionaries, etc...) Are you getting a specific error when attempting to do this?
Upvotes: 0