Best practices for enum with django models and migrations
I have a django model with a field that uses a enum for it's choices tuple like this:
VERSION_CHOICES = tuple(
(v.value, v.value) for v in ForwardsUpdateEventSensitivityVersion
)
version = models.CharField(
max_length=max(len(s[0]) for s in VERSION_CHOICES),
choices=VERSION_CHOICES,
)
What is the best practice for writing the accompanying migration?
Using the enum directly like this:
models.CharField(
choices=[
tuple(
(v.value, v.value)
for v in ForwardsUpdateEventSensitivityVersion
)
],
)
Or hardcoding the values like this:
models.CharField(
choices=[("V1", "V1"), ("V2", "V2")],
)