django模型结构以加载复杂的json数据

时间:2018-08-25 15:19:00

标签: python json django django-models

我有一个庞大的json格式的电影数据库,我想将它们加载到我编写的Python django应用程序中,该应用程序可以容纳这些数据,我的模型应该如何接受那些包含多个字典的数据。这是pastebin link to sample of Json

这是我的模式代码

from django.db import models

class Movie(models.Model):
     id_number = models.CharField(max_length=1000)
     quality = models.CharField(max_length=500)
     img = models.URLField()
     index = models.IntegerField()
     openload = models.CharField(max_length=500)
     release = models.CharField(max_length=500)
     country = models.CharField(max_length=500)
     runtime = models.CharField(max_length=500)
     pg = models.CharField(max_length=500)
     description = models.TextField()
     original_title = models.CharField(max_length=500)
     IMDB_Rating = models.CharField(max_length=500)
     TMDB_Rating = models.CharField(max_length=500)
     youtube = models.URLField(max_length=500)
     genre = models.CharField(max_length=500)
     cast = models.CharField(max_length=500)
     actors = models.CharField(max_length=500)

def __str__(self):
     return "{}".format(self.name)

0 个答案:

没有答案