Ejemplo n.º 1
0
    def handle(self, *args, **options):
        f = open('delficommentsbig.csv', "r")
        data = csv.reader(f)
        counter = 0
        for row in data:
            counter +=1
            obj = ScrappedDocument()
            obj.publishing_date = row[0]
            obj.source_id = '2'#row[1]
            obj.item_id = row[2]
            obj.item_link = row[3]
            try:
                obj.unique_id = int("%s%s" % ('2', row[2]))
            except:
                pass
            obj.author = row[4]
            obj.content = row[5]
            obj.subject_title = row[6]
            if counter == 1:
                pass
            elif obj.content == "Komentaras yra nebeaktualus, todėl neberodomas":
                pass
            else:
#                obj.save()
                try:
                    obj.save()
                except IntegrityError:
                    pass
Ejemplo n.º 2
0
 def handle(self, *args, **options):
     f = open('supermamaforumcomment.csv', "r")
     data = csv.reader(f)
     counter = 0
     for row in data:
         counter +=1
         obj = ScrappedDocument()
         obj.publishing_date = row[0]
         obj.source_id = '3'#row[1]
         obj.item_id = row[2]
         obj.item_link = row[3]
         try:
             obj.unique_id = int("%s%s" % ('3', row[2]))
         except:
             pass
         obj.author = row[4]
         obj.content = row[5]
         obj.subject_title = row[6]
         try:
             obj.save()
         except IntegrityError:
             pass