Open joshuadavidthomas opened 5 months ago
Hey @joshuadavidthomas — yes, makes sense. Is this something you'd do a PR for?
I this open to take ?
@wassafshahzad Yes, great.
Please keep the fix to just this issue here, not blending with #39 and #40, as the linked commit does. (I need to look at those separately.
A test case for the change will be needed.
Thanks! Let me know if you get stuck anywhere.
@carltongibson any specific reason you didn't use
str(getattr(object, f))
instead of object._meta.get_field(f).value_to_string(object)
here: https://github.com/carltongibson/neapolitan/blame/main/src/neapolitan/templatetags/neapolitan.py#L59C17-L59C66 ?
It looks to me like a pretty simple fix but I'm fearing it's too simple
No real reason. It just didn't occur to me when I was bashing it together.
This is probably a change we should make yes.
There are a couple of related issues about the table generation and the actions links that likely go together. The reason they're still here is I didn't get a chance to totally think them through yet, but happy to have input.
In the
object_list
andobject_detail
templatetags, a field's value is rendered using the field'svalue_to_string
method. On fields that are aForeignKey
to another model, this just renders that model's primary key, not the string representation of the model.Before:
If you change how the field's value is rendered by getting the attribute and rendering to string, you can get that related model's string representation.
After:
See this relevant commit for what this would look like.