1👍
✅
Just format the content first, and then add the django tags.
"{%" + " display_cookies_accepted {} ".format(self.client.cookies) + "%}"
Or put the tags in the format as well.
"{} display_cookies_accepted {} {}".format('{%', self.client.cookies, '%}')
Source:stackexchange.com