{"id":20336875,"url":"https://github.com/mighty-justice/django-super-deduper","last_synced_at":"2025-07-30T07:34:04.154Z","repository":{"id":48359007,"uuid":"104405088","full_name":"mighty-justice/django-super-deduper","owner":"mighty-justice","description":"Utilities for de-duping Django model instances","archived":false,"fork":false,"pushed_at":"2023-07-26T19:07:04.000Z","size":49,"stargazers_count":32,"open_issues_count":13,"forks_count":9,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-25T18:41:17.887Z","etag":null,"topics":["dedupe","django","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mighty-justice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-09-21T22:30:39.000Z","updated_at":"2025-03-21T21:56:22.000Z","dependencies_parsed_at":"2022-09-10T13:21:40.071Z","dependency_job_id":"97456441-1fcf-4ab0-bc3c-90c02ce4194e","html_url":"https://github.com/mighty-justice/django-super-deduper","commit_stats":{"total_commits":42,"total_committers":6,"mean_commits":7.0,"dds":0.5476190476190477,"last_synced_commit":"a2ddd2bf155abacf85cabf4e99b51c42c2f53ec2"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mighty-justice%2Fdjango-super-deduper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mighty-justice%2Fdjango-super-deduper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mighty-justice%2Fdjango-super-deduper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mighty-justice%2Fdjango-super-deduper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mighty-justice","download_url":"https://codeload.github.com/mighty-justice/django-super-deduper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248493022,"owners_count":21113159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dedupe","django","python"],"created_at":"2024-11-14T21:07:17.147Z","updated_at":"2025-04-11T22:41:19.068Z","avatar_url":"https://github.com/mighty-justice.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Super Deduper\n[![Build status](https://badge.buildkite.com/9895056b294e7f1a8893b9ef75bb743f3933fc3264e23eeeb2.svg)](https://buildkite.com/mighty/django-super-deduper?branch=master)\n[![Python version](https://img.shields.io/pypi/pyversions/django-super-deduper.svg)](https://pypi.python.org/pypi/django-super-deduper)\n\nA collection of classes and utilities to aid in de-duping Django model instances.\n\n## Requirements\n\n- Python 3.6\n- Django 1.11\n\n## Install\n\n`pip install django-super-deduper`\n\n## Usage\n\n### Merging Duplicate Instances\n\nBy default any [empty values](https://github.com/django/django/blob/master/django/core/validators.py#L13) on the primary object will take the value from the duplicates.\nAdditionally, any related one-to-one, one-to-many, and many-to-many related objects will be updated to reference the primary object.\n\n```python\n\u003e from django_super_deduper.merge import MergedModelInstance\n\u003e primary_object = Model.objects.create(attr_A=None, attr_B='')\n\u003e alias_object_1 = Model.objects.create(attr_A=X)\n\u003e alias_object_2 = Model.objects.create(attr_B=Y)\n\u003e merged_object = MergedModelInstance.create(primary_object, [alias_object_1, alias_object_2])\n\u003e merged_object.attr_A\nX\n\u003e merged_object.attr_B\nY\n```\n\n## Improvements\n\n- Support multiple merging strategies\n- Recursive merging of related one-to-one objects\n\n## Logging\n\nThis package does have some rudimentary logging for debugging purposes.\nAdd this snippet to your Django logging settings to enable it:\n\n```python\nLOGGING = {\n    'loggers': {\n        'django_super_deduper': {\n            'handlers': ['console'],\n            'level': 'DEBUG',\n        },\n    },\n}\n```\n\n## References\n\n- https://djangosnippets.org/snippets/2283/\n- https://stackoverflow.com/questions/3393378/django-merging-objects\n\n## Releasing\nPre-reqs:\n```sh\npip install pypandoc twine\nbrew install pandoc\n```\n\n1. Draft a new release and create new tag in Github\n2. Run `python3 setup.py sdist bdist_wheel` on `master`\n3. Upload to pypi `python -m twine upload dist/*`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmighty-justice%2Fdjango-super-deduper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmighty-justice%2Fdjango-super-deduper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmighty-justice%2Fdjango-super-deduper/lists"}