As part of a user preferences model:
DAILY = "d"
WEEKLY = "w"
FORTNIGHTLY = "f"
MONTHLY = "m"
DISABLE = "x"
EMAIL_FREQUENCY_CHOICES = {
(DAILY, 'Daily'),
(WEEKLY, 'Weekly'),
(FORTNIGHTLY, 'Fortnightly'),
(MONTHLY, 'Monthly'),
(DISABLE, 'Disabled'),
}
email_frequency = models.CharField(
max_length=1,
choices=EMAIL_FREQUENCY_CHOICES,
default=WEEKLY,
)
Every time I run makemigrations
a new migration file is created for this model, with console output of:
- Alter field email_frequency on profile
Looking at the migration files, it seems like each migration is a different permutation of the enum dictionary. Any ideas why this is happening?
EMAIL_FREQUENCY_CHOICES
is defined as a set. It should be a list or tuple.