Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signals demo - do not merge #72

Closed
wants to merge 1 commit into from
Closed

Signals demo - do not merge #72

wants to merge 1 commit into from

Conversation

shacker
Copy link
Owner

@shacker shacker commented Apr 24, 2019

Bare bones example of registering a custom signal in a django app, then calling it from somewhere else. In this case, accessing the list of lists toggles the "done" status of task 150. Provided as a starter reference to demonstrate the flexibility of signals.

Try opening task 150 in a separate tab. Then in your first tab view the list of lists. Then refresh tab #2 to see that the "completed" status of task 150 has toggled.

@shacker shacker mentioned this pull request Apr 24, 2019

# Demonstrates receiving a custom signal
# (which in turn calls an existing todo function, but could do anything)
@receiver(pizza_done)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These handlers don't need to live in signals.py - you could decorate any function in your project and everything will get wired up when the app starts.

@shacker
Copy link
Owner Author

shacker commented May 12, 2019

Closing demo of using Django Signals to trigger task modification from other parts of the project.

@shacker shacker closed this May 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant