mfa.models.User_Keys does not declare its primary key and the mfa app config does not set default_auto_field.
This means the host project's DEFAULT_AUTO_FIELD is used at runtime, despite django-mfa2s migrations
relying upon AutoField. This causes a runtime/schema mismatch in projects that use a non-integer default key (e.g. UUIDs).
To fix, just specify the default_auto_field in apps.py:
from django.apps import AppConfig
class myAppNameConfig(AppConfig):
name = "mfa"
verbose_name = "A Much Better Name"
default_auto_field = "django.db.models.AutoField"
I'll open up a PR for this. We're trying to implement django-mfa2 in a project at work, and we had to specify a custom app config to workaround it in the interim.
mfa.models.User_Keysdoes not declare its primary key and themfaapp config does not setdefault_auto_field.This means the host project's
DEFAULT_AUTO_FIELDis used at runtime, despite django-mfa2s migrationsrelying upon AutoField. This causes a runtime/schema mismatch in projects that use a non-integer default key (e.g. UUIDs).
To fix, just specify the
default_auto_fieldinapps.py:I'll open up a PR for this. We're trying to implement django-mfa2 in a project at work, and we had to specify a custom app config to workaround it in the interim.