bruth / django-preserialize

Convert your model instances and querysets into dicts and list with style.
http://bruth.github.io/django-preserialize
BSD 2-Clause "Simplified" License
41 stars 6 forks source link

Add option for merging a single related field #6

Closed bruth closed 11 years ago

bruth commented 11 years ago

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.

bruth commented 11 years ago

Implemented using the flat option for model instances.