I'm working on a Django project where we use models.TextChoices for fields like current_status. Our client requested wording updates — for example, renaming "Contacted" to "Contacted for assessment", "Booked" to "Assessment booked", and so on.
Previous Enum:
class ClientStatus(models.TextChoices):
CONTACTED = "Contacted"
BOOKED = "Booked"
Updated Enum:
class ClientStatus(models.TextChoices):
CONTACTED_FOR_ASSESSMENT = "Contacted for assessment", "Contacted for assessment"
ASSESSMENT_BOOKED = "Assessment booked", "Assessment booked"
Problem
We already have hundreds of users in the database with:
current_status = 'Contacted'
Since "Contacted" no longer exists in the model choices:
- Will migrations fail or behave unexpectedly?
- Will the Django Admin or API views break when encountering these legacy values?
- What is the correct way to rename choice values without leaving inconsistent data?
Constraints
We want to avoid creating unnecessary migrations. We want this to work for all environments (dev/staging/production). We'd prefer not to break the Admin panel or serializers.
Question
What is the safest and most Django-idiomatic way to rename or remove enum values when old data already exists in the database?
Is it okay to do manual SQL updates? Or is there a recommended Django migration approach?
What I've Tried
Ran python manage.py makemigrations and migrate. Migration did not fail.
Admin view throws errors when trying to edit users with old values.
I considered a manual SQL fix:
UPDATE api_user
SET current_status = 'Contacted for assessment'
WHERE current_status = 'Contacted';