Skip to main content

A reusable Django app to easily duplicate model records.

Project description

Django Duplicator 🔁

A lightweight mixin for Django Admin that adds object duplication functionality, both in bulk (via an Admin Action) and for single objects (via a "Duplicate and continue editing" button on the change form).


✨ Key Features

  • Single Object Duplication: A "Duplicate and continue editing" button appears on the object detail page.
  • Bulk Duplication (Admin Action): An Admin Action is provided to duplicate selected objects from the changelist page.
  • DRY and Flexible: Uses simple model and Admin mixins that are easy to integrate into any Django model.

💻 Installation

  pip install django-duplicator

Add duplicator to your INSTALLED_APPS in settings.py:

# settings.py
INSTALLED_APPS = [
    # ...
    'django.contrib.admin',
    # ...
    'duplicator',
]

🚀 Usage

  1. Model (Enabling Duplication)

To make your model duplicatable, you must inherit from DuplicatorMixin.

    # models.py
    from django.db import models
    from duplicator import DuplicatorMixin
    
    class Customer(DuplicatorMixin, models.Model):
        name = models.CharField(max_length=255)
        # ... other fields ...
    
        def __str__(self):
            return self.name
  1. Admin (Enabling Buttons and Actions)

To enable both the single duplication button and the bulk duplication Admin Action, inherit from DuplicatorAdminMixin.

# admin.py
from django.contrib import admin
from duplicator import DuplicatorAdminMixin
from .models import Customer

@admin.register(Customer)
class CustomerAdmin(DuplicatorAdminMixin, admin.ModelAdmin):
    list_display = ('name', 'id')
    # ... other admin configurations ...

📸 Feature Demonstration

A. Bulk Duplication (Admin Action)

The duplication option appears in the Actions dropdown menu on the changelist page.

Action

B. Single Duplication (Change Form Button)

The "Duplicate and continue editing" button is prominently placed on the object detail page.

Detail

🤝 Contributing

We welcome all contributions! If you find a bug or have a feature suggestion, please open an Issue or submit a Pull Request.

📄 License

This project is licensed under the [Your License Type, e.g., MIT License]. See the LICENSE file for full details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_duplicator-0.1.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_duplicator-0.1.3-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file django_duplicator-0.1.3.tar.gz.

File metadata

  • Download URL: django_duplicator-0.1.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.0 Linux/6.11.0-1018-azure

File hashes

Hashes for django_duplicator-0.1.3.tar.gz
Algorithm Hash digest
SHA256 dd035402ce629dd3653c07308a8325d8adfdc5e49a4819c9f158635b85654581
MD5 0ec88f706725477984a2f6d662d37a2f
BLAKE2b-256 b5babbfd1e9b35ba886091a031bfdd76b55677073dacadbdcf5e746b8cad3364

See more details on using hashes here.

File details

Details for the file django_duplicator-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: django_duplicator-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.14.0 Linux/6.11.0-1018-azure

File hashes

Hashes for django_duplicator-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9d9a97f343d96418741ad9342d076c8df36086ff348d9c520feb82e1ae3a4196
MD5 385020855c502c57ff96a6173f06a2ce
BLAKE2b-256 8ceff51963e67c326ad2726193da9be8449140d69642a5a5f0524385985fea35

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page