-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: display values of fields in display view #507
Conversation
- use _get_FIELD_display() to set field values to fix display values of choices using enumeration types (uses choices labels over values) - simplify check for exclude_fields by moving it into existing function call Closes: #506
edc6258
to
70fe9fe
Compare
This basically only minimally changes what's already there, not sure if it'd be preferable to get rid of the current solution altogether. This could also possibly be refactored further to simplify that earlier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I did not know about _get_FIELD_display
, that makes more sense than using the form field value, which model_to_dict
provides. I'm a little hesitant, because its a private method, but I'm ok with that for now. That refactoring makes using model_to_dict
in fact a bit useless and it might make sense to move that whole block to a templatetag, but lets just merge it for now to fix that bug and revisit the rest later
It took me a while to find out about I share your reservation about it being a private method, but old Django tickets I've dug up suggest there are no plans from the Django team to make functionality like this available in other ways, so... yah. Rest of the comment moved to #506 (comment) |
(comment moved to #506 (comment)) |
Maybe I should move my comments out of this PR and into the linked issue. |
Oups, just found this still-open PR... |
I'm not sure it makes sens to invest time in this - there is a WIP branch to refactor |
True, true, it doesn't make sense to pursue this particular PR further -> closing. |
Closes: #506