[Answered ]-Django Finite State Machine and FSMKeyField – saving forms

2👍

I ran into this same issue today and resolved it by specifying a custom Form for the model’s admin and overriding the clean function for the state property.

In your case, this might look something like:

class ClaimAdminForm(forms.ModelForm):
    def clean_state(self):
        return self.cleaned_data["state"].id


@admin.register(Claim)
class ClaimAdmin(admin.ModelAdmin):
    form = ClaimAdminForm

Leave a comment