Comments (5)
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.
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.
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.
@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.
Thanks, @charettes. I finally used ModelDefinition directly and it works fine.
from django-mutant.
Related Issues (20)
- ImportError: cannot import name 'force_unicode' HOT 1
- question about usage and pre-existing models HOT 10
- When working on multiple databases, mutant is trying to alter schema in all databases. HOT 1
- Cannot create initial DB HOT 3
- Error when creating ManyToMany Field with Django 1.9.5. HOT 1
- error in makemigrations HOT 2
- FieldDefinition didn't define any `field_class`. HOT 4
- is the model_ref need set app_label='mutant' HOT 2
- TypeError: Couldn't reconstruct field content_type on mutant.FieldDefinition: __init__() got multiple values for keyword argument 'polymorphic_type' HOT 3
- how to dynamic create foreignkeyfield HOT 2
- Django-mutant migration issues ( with fix ) HOT 1
- Error in migration HOT 2
- Error in view for New Field HOT 1
- How to make full use of django-mutant(Simply describe how it works?) HOT 4
- SQL query is executing even if the operation fails
- Unable to perform migration HOT 2
- __init__() missing 1 required positional argument: 'queryset' HOT 7
- How to get objects? HOT 1
- Getting started link broken HOT 1
- Working with DRF ?
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-mutant.