fork download
  1. class OdeskProfile(models.Model):
  2. title = models.CharField(max_length=255)
  3. skills = models.CharField(max_length=255)
  4. country = models.CharField(max_length=255)
  5. profile_id = models.CharField(max_length=255)
  6.  
  7. def fill(self):
  8. with open('test.json') as data_file:
  9. data = json.load(data_file)
  10. for items in data:
  11. test = OdeskProfile.objects.all()
  12. test.title = data[items]['title']
  13. test.skills = data[items]['skills']
  14. test.country = data[items]['country']
  15. test.profile_id = data[items]['id']
  16. test.save()
  17.  
  18. def __unicode__(self):
  19. return self.title
Runtime error #stdin #stdout #stderr 0.01s 7732KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 1, in <module>
NameError: name 'models' is not defined