The Entitlement API will allow for GET, POST, DELETE(Revoke), and variations of these methods of managing and retrieving data about Learner Entitlements. [LEARNER-2661]
22 lines
574 B
Python
22 lines
574 B
Python
from django.contrib.auth import get_user_model
|
|
from rest_framework import serializers
|
|
|
|
from entitlements.models import CourseEntitlement
|
|
|
|
|
|
class CourseEntitlementSerializer(serializers.ModelSerializer):
|
|
user = serializers.SlugRelatedField(slug_field='username', queryset=get_user_model().objects.all())
|
|
|
|
class Meta:
|
|
model = CourseEntitlement
|
|
fields = (
|
|
'user',
|
|
'uuid',
|
|
'course_uuid',
|
|
'expired_at',
|
|
'created',
|
|
'modified',
|
|
'mode',
|
|
'order_number'
|
|
)
|