示例#1
0
def list_pk_encoder(values, instance, field: Field):
    return [field.db_value(getattr(v, "pk", v), instance) for v in values]
示例#2
0
def list_encoder(values, instance, field: Field):
    """Encodes an iterable of a given field into a database-compatible format."""
    return [field.db_value(element, instance) for element in values]