fork download
  1. import json
  2. with open('data.json') as data_file:
  3. data = json.load(data_file)
  4.  
  5. class DataBox(models.Model):
  6. title = models.CharField(max_length=255)
  7.  
  8. def fillData(self, data):
  9. for items in data:
  10. self.title = data[items]['title']
  11. super(Databox, self).save()
Runtime error #stdin #stdout #stderr 0.02s 9000KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 2, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'data.json'