scrapy-djangoitem
scrapy-djangoitem copied to clipboard
How to delete existing model object from DB for saving new one in pipelines?
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()