Skip to content

Fields and filters overrides.

Capy Serializers supports overwrites fields names.

Example

import capyc.django.serializer as capy

class PermissionSerializer(capy.Serializer):
    model = Permission
    fields = {
        "default": ("id", "name"),
        "lists": ("groups",),
        "expand_lists": ("groups[]",),
    }
    rewrites = {
        "group_set": "groups",
    }
    filters = ("groups",)
    groups = GroupSerializer