Skip to content

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

@rajeshbk042

Description

@rajeshbk042

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions