[Fixed]-Copy object from one user profile to another in django

1👍

In Django you can copy an object by retrieving it from the database, clearing the id and calling the save method. In your case that would look like this:

if request.method == 'POST': 
    product = Myblackbelt.objects.get(pk=product_id)
    product.pk = None
    product.creator = request.user
    product.save()

Leave a comment