Home Django postgres : Is their any way to reference jsonfield of one model into another?
Reply: 1

Django postgres : Is their any way to reference jsonfield of one model into another?

pratik jaiswal
1#
pratik jaiswal Published in 2017-09-13 15:51:38Z

I have a jsonfoeld in a model now I want to use that jsonfield into another model . Is their any way to referrence jsonfield of one model into another? If not ,can anyone suggest a better way to do that? Thank you in advance

arjun27
2#
arjun27 Reply to 2017-09-13 18:26:16Z

There is no way to reference fields. You can do one of the following

  1. Create foreign key relationship between the models, and then refer to the json field by referring to the related model.

  2. Create a json field on the new model, and do a data migration to store the data in the new model.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.309897 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO