Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
69e28e39
Commit
69e28e39
authored
Aug 04, 2012
by
Rocky Duan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
callback to sync user info
parent
7cd09145
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
common/djangoapps/student/models.py
+27
-0
No files found.
common/djangoapps/student/models.py
View file @
69e28e39
...
...
@@ -16,6 +16,16 @@ from django.db import models
from
django.contrib.auth.models
import
User
from
django_countries
import
CountryField
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
from
functools
import
partial
import
comment_client
import
logging
#from cache_toolbox import cache_model, cache_relation
...
...
@@ -203,3 +213,20 @@ def add_user_to_default_group(user, group):
utg
.
save
()
utg
.
users
.
add
(
User
.
objects
.
get
(
username
=
user
))
utg
.
save
()
@receiver
(
post_save
,
sender
=
User
)
def
update_user_information
(
sender
,
instance
,
created
,
**
kwargs
):
if
created
:
func
=
comment_client
.
create_user
else
:
func
=
partial
(
comment_client
.
update_user
,
user_id
=
instance
.
id
)
try
:
func
(
attributes
=
{
'id'
:
instance
.
id
,
'username'
:
instance
.
username
,
'email'
:
instance
.
email
,
})
except
Exception
as
e
:
log
=
logging
.
getLogger
(
"mitx.discussion"
)
log
.
error
(
unicode
(
e
))
log
.
error
(
"update user info to discussion failed for user with id: "
+
str
(
instance
.
id
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment