Skip to content

Commit 5a2092a

Browse files
committed
add django dispatcher signal example
1 parent cc5af4b commit 5a2092a

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

content/pages/examples/django/django-dispatch-dispatcher-signal.markdown

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
title: django.dispatch.dispatcher.Signal Examples
1+
title: django.dispatch Signal Examples
22
category: page
33
slug: django-dispatch-dispatcher-signal-examples
44
sortorder: 50004
55
toc: False
6-
sidebartitle: django.dispatch.dispatcher Signal
6+
sidebartitle: django.dispatch Signal
77
meta: Python code examples for the Signal class within the django.dispatch module of the Django project.
88

99

10-
# django.dispatch.dispatcher Signal Examples
10+
# django.dispatch Signal Examples
1111
The
1212
[Signal](https://github.com/django/django/blob/master/django/dispatch/dispatcher.py)
1313
class allows certain senders to notify a set of receivers that some action
@@ -84,3 +84,24 @@ from .utils import generate_username
8484

8585
# code continues from here without any further django.dispatch.Signal references
8686
```
87+
88+
89+
## Example 3 from django-easy-timezones
90+
[django-easy-timezones](https://github.com/Miserlou/django-easy-timezones)
91+
([project website](https://www.gun.io/blog/django-easy-timezones))
92+
is a [Django](/django.html)
93+
[middleware](https://docs.djangoproject.com/en/2.2/topics/http/middleware/)
94+
[code library](https://pypi.org/project/django-easy-timezones/)
95+
to simplify handling time data in your applications using
96+
users' geolocation data.
97+
98+
[**django-easy-timezones/easy_timezones/signals.py**](https://github.com/Miserlou/django-easy-timezones/blob/master/easy_timezones/middleware.py)
99+
100+
```python
101+
# Django
102+
~~import django.dispatch
103+
104+
~~detected_timezone = django.dispatch.Signal(providing_args=["instance", "timezone"])
105+
```
106+
107+

0 commit comments

Comments
 (0)