Django Tenant Context Missing #1984
-
Hi ! I like this app very much. I was able to set Webhook, Receive Message, Send Message y a Multibot enviroment. Everything is good. Only missing one thing: I lost tenant context(postgre schema) when I am on any "command". Here is my code:
IS THERE ANY WAY TO KEEP MY DJANGO-TENANTS CONTEXT BETWEEN FUNCTIONS? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Answer my self: I was able to save current schema name in message like this: update.message.current_schema_name = current_schema_name Then I can get the schema name in def command and use it with: with schema_context (Now I am having issues with register_next_step on this multibot enviroment) |
Beta Was this translation helpful? Give feedback.
-
Sup, sorry for a delayed answer. Instead of assigning schema to Update type, you could use class-based middlewares and pass the schema to the handler |
Beta Was this translation helpful? Give feedback.
-
Example of class-based middlewares: And, instead of using register_next_step_handler try using states: |
Beta Was this translation helpful? Give feedback.
Answer my self:
I was able to save current schema name in message like this:
update.message.current_schema_name = current_schema_name
bot.process_new_messages([update.message])
Then I can get the schema name in def command and use it with: with schema_context
(Now I am having issues with register_next_step on this multibot enviroment)