classroom.serializers package

Module contents

class classroom.serializers.CourseSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[소스]

Bases: classroom.serializers.mixins.RemoveNullFieldsMixin, rest_framework.serializers.ModelSerializer

class Meta[소스]

Bases: object

extra_kwargs = {'link': {'view_name': 'courses-detail', 'lookup_field': 'id', 'lookup_url_kwarg': 'pk', 'read_only': True}}
fields = ['link', 'id', 'name', 'path', 'description', 'webUrl', 'inviteUrl', 'summary', 'summaryFormat', 'startDate', 'endDate', 'staffs', 'createdAt', 'modifiedAt', 'students', 'assignmentStatus']
model

alias of classroom.models.courses.Course

create(validated_data)[소스]

We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:

return ExampleModel.objects.create(**validated_data)

If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:

example_relationship = validated_data.pop('example_relationship') instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance

The default implementation also does not handle nested relationships. If you want to support writable nested relationships you'll need to write an explicit .create() method.

get_inviteUrl(instance)[소스]
get_refs(instance)[소스]
get_webUrl(instance)[소스]
update(instance: classroom.models.courses.Course, validated_data)[소스]
class classroom.serializers.CourseRoleSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[소스]

Bases: rest_framework.serializers.ModelSerializer

class Meta[소스]

Bases: object

extra_kwargs = {'type': {'required': False}}
fields = ['id', 'name', 'email', 'joinedAt']
model

alias of classroom.models.courses.CourseRole

create(validated_data)[소스]

We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:

return ExampleModel.objects.create(**validated_data)

If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:

example_relationship = validated_data.pop('example_relationship') instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance

The default implementation also does not handle nested relationships. If you want to support writable nested relationships you'll need to write an explicit .create() method.

run_validation(data=<class 'rest_framework.fields.empty'>)[소스]

We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a 'non_fields_error' key.

class classroom.serializers.CourseRoleRequestSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[소스]

Bases: rest_framework.serializers.Serializer

class EmailUserValidator[소스]

Bases: object

class Meta[소스]

Bases: object

fields = ['email', 'type']
create(validated_data)[소스]
create_or_update(validated_data)[소스]
update(instance, validated_data)[소스]
class classroom.serializers.CourseStudentSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[소스]

Bases: classroom.serializers.courses.CourseRoleSerializer

class Meta[소스]

Bases: object

extra_kwargs = {'type': {'required': False}}
fields = ['id', 'name', 'email', 'idNumber', 'joinedAt']
model

alias of classroom.models.courses.CourseRole

get_idNumber(instance)[소스]
class classroom.serializers.UserSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[소스]

Bases: classroom.serializers.mixins.RemoveNullFieldsMixin, rest_framework.serializers.ModelSerializer

class Meta[소스]

Bases: object

exclude = ('is_staff', 'is_active', 'date_joined', 'password', 'last_login', 'user_permissions', 'groups', 'is_superuser')
model

alias of django.contrib.auth.models.User

class classroom.serializers.AssignmentSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[소스]

Bases: classroom.serializers.mixins.RemoveNullFieldsMixin, rest_framework.serializers.ModelSerializer

class Meta[소스]

Bases: object

extra_kwargs = {'link': {'view_name': 'assignments-detail', 'lookup_field': 'id', 'lookup_url_kwarg': 'pk', 'read_only': True}, 'name': {'required': True}, 'readme': {'required': False}}
fields = ['link', 'id', 'name', 'nameWithNamespace', 'path', 'pathWithNamespace', 'description', 'webUrl', 'readme', 'readmeFormat', 'startDate', 'endDate', 'author', 'successBuilds', 'submits', 'modifiedAt', 'status', 'repository']
model

alias of classroom.models.assignments.Assignment

create(validated_data)[소스]

We have a bit of extra checking around this in order to provide descriptive messages when something goes wrong, but this method is essentially just:

return ExampleModel.objects.create(**validated_data)

If there are many to many fields present on the instance then they cannot be set until the model is instantiated, in which case the implementation is like so:

example_relationship = validated_data.pop('example_relationship') instance = ExampleModel.objects.create(**validated_data) instance.example_relationship = example_relationship return instance

The default implementation also does not handle nested relationships. If you want to support writable nested relationships you'll need to write an explicit .create() method.

get_nameWithNamespace(instance: classroom.models.assignments.Assignment)[소스]
get_pathWithNamespace(instance: classroom.models.assignments.Assignment)[소스]
get_webUrl(instance)[소스]
parent_lookup_kwargs = {'course_pk': 'course__pk'}
update(instance: classroom.models.assignments.Assignment, validated_data)[소스]
class classroom.serializers.AssignmentRepositorySerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[소스]

Bases: classroom.serializers.mixins.RemoveNullFieldsMixin, rest_framework.serializers.ModelSerializer

class Meta[소스]

Bases: object

extra_kwargs = {'branch': {'read_only': True}, 'link': {'view_name': 'assignments-repo', 'lookup_field': 'assignment_id', 'lookup_url_kwarg': 'pk', 'read_only': True}, 'origin': {'required': False, 'write_only': True}}
fields = ['link', 'origin', 'repoWebUrl', 'repoHttpUrl', 'repoSshUrl', 'branch', 'commitId']
model

alias of classroom.models.assignments.AssignmentRepository

class classroom.serializers.AssignmentRepositoryUpdateSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[소스]

Bases: classroom.serializers.mixins.RemoveNullFieldsMixin, rest_framework.serializers.Serializer

create(validated_data)[소스]
update(instance, validated_data)[소스]
class classroom.serializers.AssignmentUserRepositorySerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[소스]

Bases: classroom.serializers.mixins.RemoveNullFieldsMixin, rest_framework.serializers.ModelSerializer

class Meta[소스]

Bases: object

extra_kwargs = {'link': {'view_name': 'assignment_forks-detail', 'lookup_field': 'id', 'lookup_url_kwarg': 'pk', 'read_only': True}}
fields = ['link', 'id', 'user', 'repoWebUrl', 'repoHttpUrl', 'repoSshUrl', 'commitId', 'lastSubmittedAt', 'lastBuildStatus', 'memo']
model

alias of classroom.models.assignments.AssignmentUserRepository

class classroom.serializers.BudgetSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[소스]

Bases: rest_framework.serializers.ModelSerializer

class Meta[소스]

Bases: object

extra_kwargs = {'link': {'view_name': 'budgets-detail', 'lookup_field': 'id', 'lookup_url_kwarg': 'pk', 'read_only': True}}
fields = ('link', 'id', 'name', 'limitation', 'payment', 'startDate', 'endDate', 'spends')
model

alias of classroom.models.billings.Budget

class classroom.serializers.BudgetRefSerializer(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[소스]

Bases: rest_framework.serializers.Serializer

create(validated_data)[소스]
update(instance, validated_data)[소스]