I want to create a Django Admin Action that allows me to create a duplicate of a record.
Heres the use case.
Admin clicks the checkbox next to a record in an
You have the right idea but you need to iterate through the queryset then duplicate each object.
def duplicate_event(modeladmin, request, queryset): for object in queryset: object.id = None object.save() duplicate_event.short_description = "Duplicate selected record"