It seems bit-related fields are not on the list ( https://www.kickstarter.com/projects/mjtamlyn/improved-postgresql-support-in-django )
I think integer fields should be used as base field instead of bit fields, just like disqus's one. Reasons: 1. Supports all databases django supported. 2. Better query performance, especially in complex query cases including dozens of conditions (I believe this is main reason disqus made one) 3. Arbitrary number of options is not supported here, ManyToManyField should be used if there are many options. 4. The aim of this this field is providing a simple & fast option for limited set of choices, not mapping another database field type. (Like CommaSeparatedIntegerField and EmailField, actually this field could cover many use cases of CommaSeparatedIntegerField, plus better query performance and aggregate support) We could even call it ChoiceField to reflect the use and purpose, and hide the bitmask concept used here. Chi On Saturday, April 19, 2014 10:06:32 AM UTC+10, Russell Keith-Magee wrote: > > > Hi Chi, > > It's possible that you may get your request by way of Marc Tamlyn's > Kickstarter project - I can't confirm that bitmap fields are specifically > on todo list, but there PostgreSQL has some native representation for bit > types, so it's possible it might be on his radar. > > If it turns out BitField isn't on Marc's list, your proposal sounds > reasonable to me. I've only had a quick look at at the implementation, but > what I've seen looks sound. > > I don't think this needs a full DEP though - it's a minor feature that > just needs a ticket. > > Yours, > Russ Magee %-) > > > On Sat, Apr 19, 2014 at 3:00 AM, CHI Cheng <[email protected]<javascript:> > > wrote: > >> Hi, >> >> Is it possible to add a bitmask field to allow multiple choices for small >> set of options in lieu of ManyToManyField? >> >> For some cases, ManyToManyField is overkill. e.g. Select several days of >> week to indicate open days for stores while 7 boolean fields are too >> frustrated. >> >> Benefits to these cases: >> - Simpler database structure as 2 tables less >> - Better query performance (no joining tables). >> >> Disqus opened source their implementation ( >> https://github.com/disqus/django-bitfield ), but it supports neither >> Python 3 nor 1.7. I hope this field could get official supports. >> >> Syntax draft: >> https://github.com/chicheng/deps/blob/bitmaskfield/drafts/BitMaskField.md >> >> Chi >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django developers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to >> [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/django-developers. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-developers/c1447699-8cce-40d4-afd5-f5ade2bc3bd9%40googlegroups.com<https://groups.google.com/d/msgid/django-developers/c1447699-8cce-40d4-afd5-f5ade2bc3bd9%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/0dd9c200-26df-4641-8cd0-695bdccfdee2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
