-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding management command and function for pulling featured items (#2190
) * move create to management commands * update create * moving logic to util function and adding cms api function to grab courses for management command * create and util move * swapping the pull to a util * Finish refactoring out the logic from the filter in CourseViewSet * refactor out from v1 API as well * update to use memcached * make cache age a variable * update ordering * utils tests * API test update * fixes for test before merge * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * refactor out bool * remove unused args * fixed mgmt command * fix unenrollable * Fix ordering since Django breaks it * remove extra fields --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
80a900d
commit 0664e0f
Showing
7 changed files
with
427 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
"""Management command to manually pull a new set of featured items for the CMS home page""" | ||
|
||
from django.core.management.base import BaseCommand | ||
|
||
from cms.api import create_featured_items | ||
|
||
|
||
class Command(BaseCommand): | ||
"""Management command to manually pull a new set of featured items for the CMS home page""" | ||
|
||
help = __doc__ | ||
|
||
def handle(self, *args, **options): # pylint: disable=unused-argument # noqa: ARG002 | ||
self.stdout.write("Generating new featured courses for the CMS home page") | ||
featured_courses = create_featured_items() | ||
self.stdout.write("Featured courses set in cache") | ||
for featured_course in featured_courses: | ||
self.stdout.write(f"{featured_course}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.