-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Fixed #35628 -- Allowed compatible GeneratedFields for ModelAdmin.date_hierarchy. #18407
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
Fixed #35628 -- Allowed compatible GeneratedFields for ModelAdmin.date_hierarchy. #18407
Conversation
136ab4d
to
bb7b63e
Compare
bb7b63e
to
9e8083e
Compare
As an alternate implementation, we could do something like if field.get_internal_type() in {"DateField", "DateTimeField"}:
... This would also permit user defined date fields that don't explicitly subclass However, I tried to keep the structure of the code roughly the same. |
b3c9c4a
to
5820aec
Compare
I added a release note. Is there a way that I can render out those pages locally so that I can make sure they're formatted nicely? I don't think it's necessary to add a 'version changed' note to the date_hierarchy docs. I think a typical user of the |
Thank you! This is a special case where the release note belongs in the 5.0.8 release notes (as this is a release blocker for a monthly release of 5.0). Something like
You might need to rebase with the latest main
Yes, see this guide also have the requirements of
Correct 👍 |
7642850
to
aa97af5
Compare
|
029b33c
to
a7cf927
Compare
Fixed linter errors, squashed, force-pushed. |
a7cf927
to
eeb172e
Compare
d4e7d12
to
4c46ee1
Compare
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.
Thank you @john-parton ⭐ this looks good to me
LGTM |
4c46ee1
to
6c368bf
Compare
Fixed #35628, allow GeneratedField with appropriate output_field for date_hierarchy.
Trac ticket number
This is the basic fix for https://code.djangoproject.com/ticket/35628# , but without tests/docs. Will add tests/docs if approach is deemed appropriate.
Branch description
Essentially, there's a check to make sure that
date_hierarchy
is aDateField
orDateTimeField
, but there is no technical reason to prohibit aGeneratedField
withoutput_field
set toDateField
orDateTimeField
.This adjusts the check to allow that specific case through.
Checklist
main
branch.