class Meta: """ TODO: add me """ model = get_generated_certificate() fields = [ 'id', 'course_id', 'grade', 'mode', 'username', 'status', 'site', 'created_date' ]
"""Module that implements helper functions for other modules.""" import crum from django.conf import settings from django.contrib.auth.models import User from django.contrib.sites.models import Site from eox_core.edxapp_wrapper.certificates import get_generated_certificate from eox_core.edxapp_wrapper.users import get_edxapp_user from opaque_keys.edx.keys import CourseKey from eox_tagging.edxapp_wrappers.course_overview import CourseOverview from eox_tagging.edxapp_wrappers.enrollments import CourseEnrollment GeneratedCertificate = get_generated_certificate() def get_user(**kwargs): """Function used to get users.""" user_id = kwargs.get("target_id") if getattr(settings, "EOX_TAGGING_SKIP_VALIDATIONS", False): # Skip these validations while testing return User.objects.get(username=user_id) site = crum.get_current_request().site user = get_edxapp_user(username=user_id, site=site) return user def get_course(**kwargs): """Function used to get courses from the platform.""" course_id = kwargs.get("target_id") opaque_key = CourseKey.from_string(course_id)
def get_queryset(self): self.queryset = get_generated_certificate().objects.all() return super(CertificateViewSet, self).get_queryset()