How can I copy a queryset to a new model in django admin?
- by user3806832
I'm trying to write an action that allows the user to select the queryset and copy it to a new table. So:
John, Mark, James, Tyler and Joe are in a table 1( called round 1)
The user selects the action that say to "move to next round"
and those same instances that were chosen are now also in the table for "round 2".
I started trying with an action but don't really know where to go from here:
def Round_2(modeladmin, request, queryset):
For X in queryset:
X.pk = None
perform.short_description = "Move to Round 2"
How can I copy them to the next table with all of their information (pk doesn't have to be the same)? Thanks