[Django]-Django Admin Not Using ModelManager's create Method

5👍

Override the ModelAdmin.save_model() method:

class MyAdmin(admin.ModelAdmin):

    def save_model(self, request, obj, form, change):
        if change:
            obj.save()
        else:
            new_obj = MyModel.objects.create(name=obj.name, ...)
            obj.pk = new_obj.pk

Leave a comment