Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyTest(models.Model):
- address = models.CharField(max_length=100)
- def __unicode__(self):
- return u'%s,%s' % (self.address, self.city)
- records = csv.DictReader(self.cleaned_data["file"])
- for line in records:
- mt = MyTest()
- mt.address=line['ADDRESS'],
- mt.city=line['CITY'],
- ....
- mt.save()
- print line['ADDRESS']
- print mt.address
- 70 Mall Rd
- ('70 Mall Rd',)
- ('LARGO',), ('FL',),
- >>> True,
- (True,)
- >>> True
- True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement