Giter Site home page Giter Site logo

Comments (2)

ruscoder avatar ruscoder commented on August 21, 2024

Hello @Martin317!
Could you please share the request data you are passing to the serializer?

from drf-writable-nested.

Martin317 avatar Martin317 commented on August 21, 2024

Sure, https://pastebin.com/rqC4YP79
I created signals to print the behavior. pre_save and post_save always print that is a new object.

# Padre objects (mama and papa) are duplicating the objects because I remove `read_only:False`.
Padre PRE SAVE TestNom, TestAp PK None   
Padre POST SAVE TestNom, TestAp CREATED True
Padre PRE SAVE TestNom2, TestAp2 PK None
Padre POST SAVE TestNom2, TestAp2 CREATED True
# EstudianteNivelSecundario raise Integrity Error, duplicate primary key. it has `read_only:False`.
EstudianteNivelSecundario PRE SAVE TestNom3, TestAp3 PK None

I forgot to share EstudianteNivelSecundario Model, here is.

 class EstudianteNivelSecundario(Persona):
    papa = models.ForeignKey(Padre,
                             on_delete=models.PROTECT,
                             related_name="estudiantes_nivel_secundario_papa",
                             blank=True,
                             null=True)
    mama = models.ForeignKey(Padre,
                             on_delete=models.PROTECT,
                             related_name="estudiantes_nivel_secundario_mama",
                             blank=True,
                             null=True)

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.