0

I'm looking to make a django app that uses signals. (using django signals) There I would like to run some functions, and based on which output they give, send a message within the webpage. so for example, if the function fails i want to send a message saying it failed.

this is pretty much want i would want

in signals.py -----
def handle_event(request, *args, **kwargs):
    try: 
    --unimportant--
    except: 
       messages.error(request, 'error message') 
post_save.connect(handle_event, sender=Event)

how would i go about doing this?

3
  • What type of signals are you going to be handling, can you give an example? You may have to create some custom signals that receive the request Commented Mar 5, 2022 at 19:05
  • im just trying to get edit and created signals. so when i create a new item(event in this case) i want the function to run, does that clarify? Commented Mar 6, 2022 at 16:08
  • Might be worth looking at this package github.com/benrobster/django-threadlocals. Several of those signals can be sent outside of a request/response context so you would have to handle that Commented Mar 11, 2022 at 2:34

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.