Comments (5)
Can you provide an example?
from django-preserialize.
I have a Django model with a fk and m2m. Serialise works perfectly but when I run the following, the field is only excluded in the outer level and appears in all subsequent nestings. I haven't had too much time to look into this, perhaps using templates is the solution?
serialize(my_obj, exclude=['my_field'])
from django-preserialize.
@bee-keeper Sorry for the late response. For recursive objects or models that appear more than one in a graph, templates are very good for. Here is an example of how I define and reference them.
from django-preserialize.
Ok i had assumed that templates would be a solution, I suppose it was more a comment on the default behaviour without using a template. Please feel free to close in that case.
from django-preserialize.
I suppose it was more a comment on the default behaviour without using a template.
Yes. That being said, #5 describes an approach to define defaults per model. Also I have #14 in the works that defines a Serializer
class that would encapsulate options like these.
from django-preserialize.
Related Issues (16)
- Add ability to define object hooks for customizing output during serialization HOT 1
- Evaluating querysets HOT 3
- Issue with ThumbnailerImageField (ImageField?) HOT 7
- Serializer class improvement suggestion HOT 1
- AttributeError: 'Options' object has no attribute 'get_all_related_objects' HOT 6
- Implement resource documentation generator for models
- Rename package to djangopreserialize HOT 1
- Please support Django 1.11.x and 2.0.x HOT 4
- Add default template for rendering the serialize docs
- `:pk` pseudo-selector does not work in `key_map`
- Support setting and option for mapping models to templates HOT 1
- Add option for merging a single related field HOT 1
- Option `flat` overrides `merge` for model instances
- Missing license HOT 2
- QuerySet prehook is incorrectly propagated to models
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-preserialize.