Skip to content
This repository has been archived by the owner on Feb 21, 2020. It is now read-only.

Support setting and option for mapping models to templates #5

Open
bruth opened this issue Apr 15, 2013 · 1 comment
Open

Support setting and option for mapping models to templates #5

bruth opened this issue Apr 15, 2013 · 1 comment

Comments

@bruth
Copy link
Owner

bruth commented Apr 15, 2013

Currently, templates for related models must be defined at the level in which they are traversed. This feature proposes being able to define a model → template mapping as an option or globally.

# In project settings.. mapping model label to preserialize options
PRESERIALIZE_MODEL_TEMPLATES = {
    'library.Library': { ... },
    'library.Book': { ... },
    'library.Author': { ... },
}

from preserialize.serialize import serialize

libraries = Library.objects.all()
# Internally this use the setting as it comes across model-based data
serialize(libraries)
@bruth
Copy link
Owner Author

bruth commented Apr 15, 2013

The other side effect to this is support recursive (self) relationships since the template is defined once for the model.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant