Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. class MyTest(models.Model):
  2. address = models.CharField(max_length=100)
  3.  
  4. def __unicode__(self):
  5. return u'%s,%s' % (self.address, self.city)
  6.  
  7. records = csv.DictReader(self.cleaned_data["file"])
  8. for line in records:
  9. mt = MyTest()
  10. mt.address=line['ADDRESS'],
  11. mt.city=line['CITY'],
  12. ....
  13. mt.save()
  14. print line['ADDRESS']
  15. print mt.address
  16.  
  17.  
  18. 70 Mall Rd
  19. ('70 Mall Rd',)
  20.  
  21. ('LARGO',), ('FL',),
  22.  
  23. >>> True,
  24. (True,)
  25. >>> True
  26. True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement