I have some questions on my site and I want them to be seen only by users that I want. I created a profile class and for each profile I want to create a boolean Field for each question. For the moment my code looks like this :
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
accessquestion1 = models.BooleanField(default=True)
accessquestion2 = models.BooleanField(default=True)
accessquestion3 = models.BooleanField(default=True)
Can I optimize this code with a kind of 'boolean foreign key' ??
Aucun commentaire:
Enregistrer un commentaire