views:

63

answers:

1

I've been searching for an elegant way to represent a multi-select weekday field (Mon, Tues, Wed...) in a Django model. I was initially thinking of going integer field using bitwise math but I am not sure if this would be the way to go.

This would be a mostly-read field. I would want the Queryset method to be something like Entry.objects.get(weekdays__contains=MONDAY) Where MONDAY would be a constant.

Perhaps someone could come up with a better solution? Or maybe someone has done something similar and has some example code they could contribute?

A: 
celopes
But how would the model be defined? What would the weekday field be? Adrian's answer leaves out the Model field definition.
Nimmy Lebby
Celopes: Hate to be persistent, but I am very curious as to what your solution was leading up to.
Nimmy Lebby