I have a campaign model as follows:
id campaign objective platform
1 Hello Word MOBILE_APP_ENGAGEMENT Facebook
2 Hi There VIDEO_VIEWS_PREROLL Twitter
Model:
class Campaign(Model):
id = models.TextField(primary_key=True)
name = models.TextField(default="")
objective = models.TextField(null=True)
platform = enumfields.EnumField(Platform, max_length=10, null=True)
The campaign holds both Twitter and FB campaigns.
The objective field was a free text, but I am not happy with it.
I would like to create 2 different enums (enum34):
class FacebookObjective(Enum):
MOBILE_APP_ENGAGEMENT
MOBILE_APP_DOWNLOAD
class TwitterObjective(Enum):
VIDEO_VIEWS_PREROLL
TWEET_ENGAGEMENTS
and somehow use them on the same column. but not sure how to do it.
I thought to use enum, because I need the other uses to use it easily in the code. e.g:
TwitterObjective.VIDEO_VIEWS_PREROLL