In my case i wants to store object of my USER class to be stored as session variable To be more precise my class contains several methods for USER structure of my USER class
class USER:
def __init__(self , phone_number_of_user = None , user_name = None):
self.phone_number = phone_number_of_user
self.user_name = user_name
def login(self):
login_code_will_be_here
def get_user_name(self):
return self.user_name
def set_data_of_user_in_firebase(self , data = None):
code to set data of user will be here
firstly i create a USER object
user = USER(phone_number = 9******** , user_name = John)
But when i tries to store my objects in session of django like this
request.session['user'] = user
django shows me following error
Object of type USER is not JSON serializable
Aucun commentaire:
Enregistrer un commentaire