python - How to manually populate Many-To-Many fields through JSON fixture in Django -


i have json fixture , want populate many-to-many field json fixture seems django wants 1 pk need pass in lot of integers representing pks other related fields.

is there anyway go this.

i have used raw_id = ['reference(my table name)'] in modeladmin pks can used reference related fields.

the error message is

file "/usr/local/lib/python2.7/dist-packages/django/core/serializers/python.py", line 142, in deserializer raise base.deserializationerror.withdata(e, d['model'], d.get('pk'), pk) django.core.serializers.base.deserializationerror: problem installing fixture '/home/user/desktop/file/data/file.json':

[u"',' value must integer."]: (kjv.verse:pk=1) field_value ','

you can use jsonfield() django model

from django.contrib.postgres.fields import jsonfield raw_id=jsonfield(primary_key=true,db_index=true,null=true) 

s0 database {raw_id:[1,2,3,4]}


Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -