-
Notifications
You must be signed in to change notification settings - Fork 19
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
feat: synchronize restricted courses from discovery #973
Conversation
976fdf3
to
95decdb
Compare
defaults={ | ||
'_json_metadata': course_metadata_dict, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we just overwrite _json_metadata instead of deferring to the existing one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what defaults
does for update_or_create
(and why"defaults" is a poorly-named keyward arg):
The update_or_create method tries to fetch an object from database based on the given kwargs. If a match is found, it updates the fields passed in the defaults dictionary.
https://docs.djangoproject.com/en/4.2/ref/models/querysets/#update-or-create
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:shriek: I fear I've been misusing update_or_create for years now...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far!
cd2b1c1
to
50210b6
Compare
50210b6
to
bd8a35f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
https://2u-internal.atlassian.net/browse/ENT-9570
This is one of two PRs required for the ticket. In this one, we'll deal only with synchronizing top-level restricted courses.
Post-review