2

I'm making a customer support popup bot in Flask. I added the customer support popup bot to the layout template in the base.html file so that it appears on all of the routes.

In the customer support bot it has a form to get user input, but I can't figure out a way to get the post/get request from the bot. Since the bot is not in the views route.

I am not sure how to send and get info to my layout/customer_support.html page. Since the page is not rendering constantly.

Any advice on how to send the info back and retrieve the info from my layout/customer_support.html bot would be much appreciated thanks

EDIT: I'm aware of context manager, but now sure how to get the post/get information from my layout/customer_support.html form with the context manger. Am I suppose to somehow route the layout to get post/get request?

Some link I tried Flask + Jinja: Pass Data to a Base Template/All Templates

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
dragonn
  • 311
  • 5
  • 20

1 Answers1

0

Maybe make a session like:

import from flask_session import Session

And then create a session function

def session_support(chat):

    if "support" not in session:
       session["support"] = []
    else:
       session["support"].append(chat)

This might work somehow...