Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.web
Commits
6720584a
Commit
6720584a
authored
4 years ago
by
Flavio TARSETTI
Browse files
Options
Downloads
Patches
Plain Diff
[accounts][signals] supervision_request signal creation/handler
parent
f27f4b3a
No related branches found
No related tags found
1 merge request
!334
Activity stream notification for supervision requests
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/web/accounts/signals.py
+15
-0
15 additions, 0 deletions
beat/web/accounts/signals.py
with
15 additions
and
0 deletions
beat/web/accounts/signals.py
+
15
−
0
View file @
6720584a
...
...
@@ -35,8 +35,14 @@ from django.conf import settings
from
rest_framework.authtoken.models
import
Token
from
actstream
import
action
from
.models
import
AccountSettings
import
django.dispatch
supervision_request
=
django
.
dispatch
.
Signal
()
@receiver
(
post_save
,
sender
=
User
)
def
setup_user
(
sender
,
instance
,
created
,
**
kwargs
):
...
...
@@ -45,3 +51,12 @@ def setup_user(sender, instance, created, **kwargs):
instance
.
groups
.
add
(
default_group
)
Token
.
objects
.
create
(
user
=
instance
)
AccountSettings
.
objects
.
create
(
owner
=
instance
)
@receiver
(
supervision_request
)
def
on_supervision_request
(
sender
,
**
kwargs
):
action
.
send
(
sender
.
supervisee
,
verb
=
"
has requested supervision from
"
,
target
=
sender
.
supervisor
,
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment