[Fixed]-MultiSelectField in Django Models

1๐Ÿ‘

I would propose something like this:

DAY_CHOICES = (
    ('01', 'Sunday'),
    ('02', 'Monday'),
    # etc
)

class Professional(models.Model):
   # add smth here


class Record (models.Model):
    professional =  models.ForeignKey(Professional, null=True),

    availability = models.CharField(
        _('available'), max_length=10,
        choices=DAY_CHOICES,
        blank=True, null=True,
    )

class Timetable (models.Model):
   record =  models.ForeignKey(Record, null=True),

So you will be able to filter either professionals or days or both

๐Ÿ‘คsr3z

Leave a comment