Skip to content

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

Open
zaharazod wants to merge 1 commit into
disqus:masterfrom
zaharazod:master
Open

Add get_FIELD_active -> [], get_FIELD_display -> str, similar to Djan…#112
zaharazod wants to merge 1 commit into
disqus:masterfrom
zaharazod:master

Conversation

@zaharazod

Copy link
Copy Markdown

…go's enum helper method (get_FIELD_display).

@mateuszmandera

Copy link
Copy Markdown
Contributor

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

@zaharazod

Copy link
Copy Markdown
Author

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.

@mast22

mast22 commented Oct 13, 2020

Copy link
Copy Markdown

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

@timabbott

Copy link
Copy Markdown
Collaborator

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants