Giter Site home page Giter Site logo

Comments (7)

isasiluispy avatar isasiluispy commented on August 21, 2024

totally agree, this is a duplicated of my issue #49 , take a look
I am using the way you are saying (switching the lines) and works perfectly.

from drf-writable-nested.

ruscoder avatar ruscoder commented on August 21, 2024

@isasiluispy @dz0 Hello! Thanks for the contribution. It really makes sense. I'll prepare a fix soon.

from drf-writable-nested.

ruscoder avatar ruscoder commented on August 21, 2024

I've found that your solution breaks some important tests.

from drf-writable-nested.

ruscoder avatar ruscoder commented on August 21, 2024

I've fixed another bug in delete method.

Now, only one test is broken when I switch update and delete:
WritableNestedModelSerializerTest.test_update_reverse_one_to_one_without_pk

This test covers functionality from this PR #36

from drf-writable-nested.

isasiluispy avatar isasiluispy commented on August 21, 2024

@ruscoder will this bug be fixed ? I think it's not wotking properly yet, for unique_together constraints
like this example #49 I still have to swicth the lines to get it working :(

from drf-writable-nested.

ruscoder avatar ruscoder commented on August 21, 2024

@isasiluispy Your suggested fix brakes functionality from #36. I don't know how we can fix it saving backward compatibility for the moment.

As for me, I don't understand the worth of #36, but a few people asked for this feature.
If you want, you can make a PR with fix for #36 and for this issue.

from drf-writable-nested.

claytondaley avatar claytondaley commented on August 21, 2024

To solve this problem, the logic in #36 needs to be moved into its own utility function and update changed to:

        self.materialize_one_to_one_pk(instance, reverse_relations)  # code from #36 relocated here
        self.delete_reverse_relations_if_need(instance, reverse_relations)
        self.update_or_create_reverse_relations(instance, reverse_relations)

Hopefully that helps someone who's motivated. I can't help ATM because I'm just here to evaluate the project as a replacement for our DIY logic.

from drf-writable-nested.

Related Issues (20)

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.