Signals demo
This commit is contained in:
parent
befc7ad2cd
commit
470e471678
2 changed files with 30 additions and 0 deletions
|
@ -9,6 +9,7 @@ from todo.forms import SearchForm
|
|||
from todo.models import Task, TaskList
|
||||
from todo.utils import staff_check
|
||||
|
||||
from todo.signals import pizza_done
|
||||
|
||||
@login_required
|
||||
@user_passes_test(staff_check)
|
||||
|
@ -16,6 +17,11 @@ def list_lists(request) -> HttpResponse:
|
|||
"""Homepage view - list of lists a user can view, and ability to add a list.
|
||||
"""
|
||||
|
||||
# Demonstrates sending a custom signal from elsewhere in the project.
|
||||
# In this case when the list of lists is viewed, I'm going to toggle
|
||||
# the "completed" state of task 150 (just for example's sake).
|
||||
pizza_done.send(sender="foobar", toppings=["anchovies", "parmesan"], size=7, task_id=150)
|
||||
|
||||
thedate = datetime.datetime.now()
|
||||
searchform = SearchForm(auto_id=False)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue