Coder Social home page Coder Social logo

Comments (5)

charettes avatar charettes commented on June 29, 2024

I'm trying to serializing ModelDefinition using DRF

What exactly is DRF?

I can create model record in mutant_modeldefinition. But the table related was not created.

You must create your model definition through the Django ORM (e.g. ModelDefinition.objects.create). Directly Inserting a row in the mutant_modeldefinition won't create the related table.

from django-mutant.

lijax avatar lijax commented on June 29, 2024

hi @charettes. Thanks.

I'm using Django Rest Framework and trying to setup apis for ModelDefinition and FieldDefinition.

So that means all fields should be passed to ModelDefinition.objects.create() function to create related table. And no matter the object is saved or not, the table will be created? If so, I think I can let the normal DRF serializing process to create the item in mutant_modeldefinition table. And then create an ModelDefinition object without saving it.

from django-mutant.

lijax avatar lijax commented on June 29, 2024

Sorry. I misunderstood. create() will definitely insert an item.
But I found where the problem is. It's because I'm using as subclass of ModelDefinition, class NoteType(ModelDefinition). Is it possible to make NoteType work like ModelDefinition?

from django-mutant.

charettes avatar charettes commented on June 29, 2024

@lijax Ahh it must be related to the way Django deals with inheritance and signals. I suggest you take a look at the mutant.management.__init__ module to identify all signals receiver attached directly to ModelDefinition and make sure to connect them to your ModelDefinition subclass.

from django-mutant.

lijax avatar lijax commented on June 29, 2024

Thanks, @charettes. I finally used ModelDefinition directly and it works fine.

from django-mutant.

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.