I’d like to know what is the best way to store users’ preferences in Django.
Let’s say I have three choices users can select.
Based on their selection I want to customize certain templates.
Is it better to save each choice/preference as BooleanField() or as a tuple of choices?
Boolean:
subscription_newsletter = model.BooleanField()
subscription_posts = model.BooleanField()
subscription_promotions = model.BooleanField()
Tuple:
SUBSCRIPTION_CHOICES = (
("newsletter","Newsletter"),
("posts", "Posts"),
("promotions", "Promotions"),
)
It depends, whether you want them to be able to choose just one option (then tuples) or many (then booleans).