-
Notifications
You must be signed in to change notification settings - Fork 171
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
fix: Fix Source matching query does not exist error #4191
fix: Fix Source matching query does not exist error #4191
Conversation
@@ -48,7 +48,7 @@ class CoursesApiDataLoader(AbstractDataLoader): | |||
|
|||
def __init__(self, partner, api_url=None, max_workers=None, is_threadsafe=False, enable_api=True): | |||
super().__init__(partner, api_url, max_workers, is_threadsafe, enable_api) | |||
self.default_product_source = Source.objects.get(slug=settings.DEFAULT_PRODUCT_SOURCE_SLUG) | |||
self.default_product_source, __ = Source.objects.get_or_create(name=settings.DEFAULT_PRODUCT_SOURCE_SLUG, slug=settings.DEFAULT_PRODUCT_SOURCE_SLUG) |
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.
name is not necessarily the same as slug (edX vs edx).
6448afe
to
4f4f163
Compare
@ziafazal are you going to create a backport-PR to Quince? |
course_discovery/settings/base.py
Outdated
DEFAULT_PRODUCT_SOURCE_NAME = '' | ||
DEFAULT_PRODUCT_SOURCE_SLUG = '' |
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.
please set name to 'edX' and slug to 'edx' to ensure it does not cause issue when attempting to create the first object.
fix: fix quality issue and reviewer feedback fix: broken test fix: broken test fix: broken test fix: broken test chore: reviewer feedback
3e9dfac
to
e091213
Compare
While setting up course discovery for first time
refresh_course_metadata
command breaks with this error.Reason for this is we don't have and entry with
settings.DEFAULT_PRODUCT_SOURCE_SLUG
inSource
of coursemetadata app.This PR creates entry with
settings.DEFAULT_PRODUCT_SOURCE_SLUG
inSource
if it does not exist to get rid ofSource matching query does not exist
error.