bruth / django-preserialize

Convert your model instances and querysets into dicts and list with style.

Home Page:http://bruth.github.io/django-preserialize

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add option for merging a single related field

bruth opened this issue · comments

This is a common idiom:

template = {
    'fields': ['chr'],
    'key_map': {
        'chr': 'label',
    },
    'merge': True,
}

Which maps a single field on the related model and merges it into the parent model under the same name.

Implemented using the flat option for model instances.