[Answered ]-How do I get and pass context from one form to another based on primary/foreign key fields?

1👍

This would seem a job for session variables. Once your customer is created by your save function, you can grab the id and place it in a session variable for later reference.

if form.is_valid():
    customer = form.save()
    request.session['customer_id'] = customer.id

You can access this wherever you need, either as request.session['customer_id'] (or request.sessions.get('customer_id') to return None if not set) in a functional view or self.request as above in a class based view.

More info in the docs

Leave a comment