Hope you all are fine. I want to use the exec() function in django to execute my strings picked from the database. The code I wrote is working in just python script but not working in Django views. Below is my code in python script which I'm running in notebook.
ticker = 'AAPL'
title = 'f"hey {ticker} is a really doing good."'
exec('title = ' + title)
print(title)
But same code in Django views is not executing. Below is the code in views.py.
ticker = 'AAPL'
title = queryset.title #The title here is The {ticker} is not doing good.
exec('title = ' + title)
It is not giving the write anwser, just returning the first title as shown below.
The {ticker} is not doing good. Thats is the {ticker} body.
If anyone have any solution, kindly help me to figure it out.