Coder Social home page Coder Social logo

wapi's Issues

Serialize objects

Hi people. i have a problem... I have a Brand Object with name and id attributes. Then i have a Car with name, color, and foreign key to Brand Object. I need to return a JSON response with a list of Brands and foreach brand display all the cars, but when i do that, my response is
[
{
id:"1",
name:"Ford",
cars:
[
{Car object},
{Car object}
]
}
]

So, the Car object isn't serialized... how can i do that??? Please is urgent!!

Commit e3f065 Breaks Custom Serializers for Custom QuerySets

One of my models uses a custom QuerySet and Manager. When I return a SerializableResponse of "CustomQuerySet", my object serializer is ignored and instead a response is returned like:

<customqueryset>
    <field1>val1</field1>
    <field2>val2</field2>
    ...
</customqueryset>

This was not the case prior to the latest commit; reverting to the previous commit fixed the issue.

Serializer return queryset class name insted of object class name

serializer return

<objects>
    <queryset>
        <field1></field1>
    </queryset>
    <queryset>
        <field1></field1>
    </queryset>
<objects>

instead of

<objects>
    <objectname>
        <field1></field1>
    </objectname>
    <objectname>
        <field1></field1>
    </objectname>
<objects>

I think the error is in serializers/init.py

156 - fmt.format_list([get_object_serialization(objs, method).apply(obj, *_kwargs) for obj in objs])
156 + fmt.format_list([get_object_serialization(obj, method).apply(obj, *_kwargs) for obj in objs])

( objs => obj )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.