[Fixed]-Django Integrity Error when adding post in a form that excludes a foreign key

1👍

Like that:

class ObjectAdmin(admin.ModelAdmin):
    def save_model(self, request, obj, form, change):
        obj.user = request.user
        obj.save()

Leave a comment