skillfed

django-clone

Create a clone of a django model instance.

django-clone v5.5.0 221.4K downloads/30d#9,278 on PyPI130
Permissive license MIT/Apache-2.0 Active released

What it is and what it does

django-clone provides a mixin and model base class that lets you duplicate Django model instances with explicit control over which fields and relationships get copied. Instead of the naive `instance.pk = None; instance.save()` approach—which copies more state than intended—this package lets you specify exactly which fields, many-to-many relationships, and one-to-many relationships should be included in the clone. It automatically detects unique fields and appends a suffix to avoid constraint violations.

The package integrates with Django Admin, allowing cloning directly from list and change views. It supports multi-database operations, signals for pre- and post-clone hooks, and both explicit (include-only) and implicit (exclude-only) field selection. It has been actively maintained since its first release, supports Django 2.x through 4.x, and works with Python 3.6 and later.

Use it for:

  • Duplicate a product listing in an e-commerce app while automatically handling unique SKU fields.
  • Clone a survey or form template with all its questions and options, excluding responses.
  • Create a copy of a project or task in a project management tool without duplicating timestamps or status fields.
  • Bulk-clone model instances across multiple databases in a multi-tenant application.
  • Add a 'Duplicate' action to Django Admin for quick instance copying with controlled field selection.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Duplicates Django model instances with fine-grained control over which fields and relationships are copied, automatically handling unique field conflicts.

Yes. The package solves a real Django problem (safe model duplication) with low install friction, active maintenance, no known vulnerabilities, and permissive licensing. It is well-tested and integrates cleanly with Django Admin. Install it if you need to duplicate model instances with control over which fields and relationships are copied.

Install

django-clone on PyPI

pip

pip install django-clone

uv

uv add django-clone

poetry

poetry add django-clone

Installing django-clone

Before you install

Low install friction with a pure-Python wheel distribution. Actively maintained with recent commits and no known vulnerabilities. Depends only on django, conditional, and six.

License in practice

Dual-licensed under MIT and Apache-2.0 (permissive). Either license permits commercial and private use with minimal restrictions.

Quickstart

pip install django-clone

from django_clone import CloneMixin

class MyModel(CloneMixin, models.Model):
    name = models.CharField(max_length=100)

original = MyModel.objects.get(pk=1)
clone = original.clone()

Requires Django 2.0 or later; Python 3.6+. Must add django-clone to INSTALLED_APPS before django.contrib.admin if using admin integration.

Verify before relying

  • Whether the package handles all Django ORM field types without manual intervention.
  • Performance characteristics when cloning instances with large many-to-many or one-to-many relationship sets.
  • Exact behavior of unique field suffix generation when multiple clones are created in rapid succession.

Package facts

License MIT/Apache-2.0 (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 3 — django, conditional, six
Maintenance actively maintained — 430 days since the last release
Last repo commit
First released
Downloads 221,419/month — #9,278 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_clone-5.5.0-py3-none-any.whl

Keywords: django, django-clone, django clone, django object clone, clone-django, model cloning, django instance duplication, django duplication

Development Status :: 5 - Production/StableFramework :: Django :: 2.0Framework :: Django :: 2.1Framework :: Django :: 2.2Framework :: Django :: 3.0Framework :: Django :: 3.1Framework :: Django :: 3.2Framework :: Django :: 4.0Framework :: Django :: 4.1Framework :: Django :: 4.2Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTP

Tags

django model cloningduplicate django instancesdjango object duplicationclone model fieldsdjango model copyingunique field handlingdjango instance clone
django-ormmodel-duplicationadmin-integration

More WWW/HTTP packages