scrapy-djangoitem icon indicating copy to clipboard operation
scrapy-djangoitem copied to clipboard

How to delete existing model object from DB for saving new one in pipelines?

Open rajeshbk042 opened this issue 8 years ago • 0 comments

I have wrote new delete function to delete existing model item if commit=False, but its not working, not showing any error. How can I achieve this? because I want to implement dynamic custom crawler as all scraping sites are dynamic, its updating contents at each specific time.

Help me please....

class SaveItem(DjangoItem): django_model = ThinData

def save(self, commit=True): if not commit: self.delete(self.instance)

def delete(self, item): """

:param item:
:return:
"""

item.delete()

rajeshbk042 avatar Aug 06 '15 04:08 rajeshbk042