Skip to content

Split two lists/iterables of objects "wanted_state", "existing_state" in 3 lists "create", "update", "delete" #567

Description

@LLyaudet

Hello,
I'm trying to find the best way to modify the database when I want to copy some object parametering from one site to one site in Django.
Let's assume I have a model

class MyModel:
    def __init__(self, some_id, name, site_id):
        self.id = some_id
        self.name = name
        self.site_ids
        # ... some other interesting fields I want to copy

The ids and site_ids are distinct between the two sites.
However, I would like to pair objects by name and do only the database modifications that are required.
What is the best way to do this using toolz API, please ?
I will detail some solutions I have found later.
Best regards,
Laurent Lyaudet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions