django-bitfield icon indicating copy to clipboard operation
django-bitfield copied to clipboard

Add get_FIELD_active -> [], get_FIELD_display -> str, similar to Djan…

Open zaharazod opened this issue 5 years ago • 4 comments

…go's enum helper method (get_FIELD_display).

zaharazod avatar May 12 '20 13:05 zaharazod

@zaharazod Thanks for submitting this! Can you explain what this does and why?

mateuszmandera avatar May 13 '20 14:05 mateuszmandera

Hi! Essentially convenience methods. I was originally using Django's builtin enum fields, which provide a handy get_FIELD_display (string representing current selection). These are two such abstractions that, when I transitioned to bitfield, I found I was doing often. _active returns an array of strings for the currently selected bits, and _display reduces them to a comma-separated string (that last is obviously negotiable). Take all/some/none of it, just saved me a little time.

zaharazod avatar Jun 01 '20 16:06 zaharazod

Any update on this PR? Actually cool feature, any chance if this will be merged?

mast22 avatar Oct 13 '20 13:10 mast22

@mast22 I think a change like this is unlikely to be merged without tests and documentation. (It's also failing CI).

This project's maintainers don't have a huge amount of time for it so I think we're unlikely to do that cleanup work ourselves.

timabbott avatar Oct 13 '20 22:10 timabbott