Skip to main content

A simple Django app to duplicate model instance in admin.

Project description

Model Duplication

Django admin have `save_as` feature, but that feature have bug with images field, and sometime you want 100% duplication of a model instance with all other related objects and customization, then `save_as` doesn't fit for that purpose.

.. image::

Quick start

1. Add "modelduplication" to your INSTALLED_APPS setting like this:

.. code-block:: python

# ...

2. Define `pre_duplicate` and `post_duplicate` to your models to customize duplication process:

.. code-block:: python

class Book(models.Model):
def pre_duplicate(self, origin, first_level):
"""This method use to modify object before `save` on duplication.
:type origin models.Model
:type first_level bool
:param first_level is the root level of duplication
:param origin the origin instance

def post_duplicate(self, origin):
"""This method is called after finishing the duplication.
:type origin models.Model
:param origin the origin instance

Project details

Download files

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

Files for django-modelduplication, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size django-modelduplication-0.1.4.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page