cri_api.serializers package

class cri_api.serializers.CRIComputedMembershipSerializer(*args, **kwargs)[source]

Bases: cri_api.serializers.base.FieldExclusionSerializerMixin, rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

fields = ('group', 'user', 'begin_at', 'end_at', 'graduation_year', 'is_current')
model

alias of cri_models.models.crigroup.CRIComputedMembership

class cri_api.serializers.CRIGroupSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.HyperlinkedModelSerializer

class Meta[source]

Bases: object

extra_kwargs = {'url': {'lookup_field': 'slug'}}
fields = ('url', 'slug', 'gid', 'name', 'kind', 'members_url', 'history_url', 'mail_aliases', 'managers', 'private')
model

alias of cri_models.models.crigroup.CRIGroup

class cri_api.serializers.CRIMembershipSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

extra_kwargs = {'url': {'lookup_field': 'id'}}
fields = ('id', 'group', 'begin_at', 'end_at', 'graduation_year', 'is_current')
model

alias of cri_models.models.crigroup.CRIMembership

create(validated_data)[source]

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.

class cri_api.serializers.CRIPhotoKindSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

fields = ['name', 'priority']
model

alias of cri_models.models.criuser.CRIPhotoKind

class cri_api.serializers.CRIPhotoSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

fields = ['uuid', 'user', 'kind', 'image', 'image_thumb', 'image_square', 'priority']
model

alias of cri_models.models.criuser.CRIPhoto

create(validated_data)[source]

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.

class cri_api.serializers.CRIUserCreateSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

fields = ('login', 'uid', 'primary_group', 'first_name', 'last_name', 'legal_first_name', 'legal_last_name', 'email', 'phone', 'birthdate', 'memberships', 'kerberos_principals', 'nickname', 'callsign')
model

alias of cri_models.models.criuser.CRIUser

create(validated_data)[source]

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.

validate(attrs)[source]
class cri_api.serializers.CRIUserSearchSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.Serializer

class cri_api.serializers.CRIUserSerializer(*args, **kwargs)[source]

Bases: rest_framework_serializer_field_permissions.serializers.FieldPermissionSerializerMixin, cri_api.serializers.user.ProfileSerializer

class cri_api.serializers.CampusSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.HyperlinkedModelSerializer

class Meta[source]

Bases: object

extra_kwargs = {'url': {'lookup_field': 'slug'}}
fields = ('url', 'slug', 'group', 'name')
model

alias of cri_models.models.crigroup.Campus

class cri_api.serializers.CardGenerationSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.Serializer

is_valid(raise_exception=False)[source]
save(**kwargs)[source]
validate_login(value)[source]
validate_template(value)[source]
class cri_api.serializers.FieldExclusionSerializerMixin(*args, **kwargs)[source]

Bases: object

to_representation(instance)[source]
class cri_api.serializers.MailAliasSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

fields = ('email',)
model

alias of cri_models.models.mail.MailAlias

class cri_api.serializers.NestedCRIMembershipCreateSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

fields = ('group', 'begin_at', 'end_at', 'graduation_year')
model

alias of cri_models.models.crigroup.CRIMembership

class cri_api.serializers.NestedKerberosPrincipalSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.ModelSerializer

class Meta[source]

Bases: object

fields = ('principal', 'is_primary', 'out_of_date')
model

alias of cri_models.models.criuser.KerberosPrincipal

class cri_api.serializers.ProfileSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.HyperlinkedModelSerializer

class Meta[source]

Bases: object

extra_kwargs = {'uid': {'required': False}, 'url': {'lookup_field': 'username', 'lookup_url_kwarg': 'login'}}
fields = ('url', 'login', 'uid', 'primary_group', 'first_name', 'last_name', 'legal_first_name', 'legal_last_name', 'email', 'mail_aliases', 'phone', 'birthdate', 'groups_history', 'current_groups', 'old_accounts', 'new_account', 'nickname', 'callsign', 'sshkeys')
model

alias of cri_models.models.criuser.CRIUser

class cri_api.serializers.SSHPublicKeySerializer(*args, **kwargs)[source]

Bases: rest_framework_serializer_field_permissions.serializers.FieldPermissionSerializerMixin, cri_api.serializers.base.FieldExclusionSerializerMixin, rest_framework_nested.serializers.NestedHyperlinkedModelSerializer

class Meta[source]

Bases: object

extra_kwargs = {'url': {'lookup_field': 'id'}}
fields = ('id', 'title', 'key', 'key_type', 'key_length')
model

alias of cri_models.models.criuser.SSHPublicKey

create(validated_data)[source]

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.

to_representation(instance)[source]

Object instance -> Dict of primitive datatypes.

class cri_api.serializers.SimpleCRIGroupSerializer(*args, **kwargs)[source]

Bases: rest_framework.serializers.HyperlinkedModelSerializer

class Meta[source]

Bases: object

extra_kwargs = {'url': {'lookup_field': 'slug'}}
fields = ('url', 'slug')
model

alias of cri_models.models.crigroup.CRIGroup

class cri_api.serializers.SimpleCRIUserSerializer(*args, **kwargs)[source]

Bases: rest_framework_serializer_field_permissions.serializers.FieldPermissionSerializerMixin, rest_framework.serializers.HyperlinkedModelSerializer

class Meta[source]

Bases: object

extra_kwargs = {'url': {'lookup_field': 'username', 'lookup_url_kwarg': 'login'}}
fields = ('url', 'login', 'old_accounts', 'new_account')
model

alias of cri_models.models.criuser.CRIUser

Submodules