This introduces two admin actions: * Dump to CourseGraph (respect cache), and * Dump to CourseGraph (override cache) which allow admins to select a collection of courses from Django admin and dump them to the Neo4j instance specified by settings.COURSEGRAPH_CONNECTION, with or without respecting the cache (that is: whether the course has already been dumped since its last publishing).
22 lines
575 B
Python
22 lines
575 B
Python
"""
|
|
(Proxy) models supporting CourseGraph.
|
|
"""
|
|
|
|
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
|
|
|
|
|
|
class CourseGraphCourseDump(CourseOverview):
|
|
"""
|
|
Proxy model for CourseOverview.
|
|
|
|
Does *not* create/update/delete CourseOverview objects - only reads the objects.
|
|
Uses the course IDs of the CourseOverview objects to determine which courses
|
|
can be dumped to CourseGraph.
|
|
"""
|
|
class Meta:
|
|
proxy = True
|
|
|
|
def __str__(self):
|
|
"""Represent ourselves with the course key."""
|
|
return str(self.id)
|