[Answer]-How to write Session_id to a table using Class based view in Django

1👍

 def form_valid(self, form):         
       # self.object will contain the object that the view is operating upon.
       self.object = form.save(commit=False) 
       self.object.session_id = self.request.session['s_id']    
       self.object.save()

Leave a comment