-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
date_hierarchy
on related fields in ForeignKey
doesn't work.
#244
Comments
like this class ChildModel(admin.ModelAdmin):
date_hierarchy = "fk__parent_fields" exception like this: FieldDoesNotExist at /it/app/model/
Model has no field named "fk_model__parent_field" i think the problem is in this functions of template_tags in admin_interface/templatetags/admin_interface_tags.py, line 135, in admin_interface_date_hierarchy_removal_link @register.inclusion_tag("admin_interface/date_hierarchy_removal_link.html")
def admin_interface_date_hierarchy_removal_link(changelist, date_field):
date_label = changelist.model._meta.get_field(date_field).verbose_name
...........................etc |
@FraCata00 thank you for reporting this. Just for being 100% sure, does it work correctly if you don't use |
@fabiocaccamo yes it work 100% |
@fabiocaccamo if U want, after work I can fix that, I try |
@FraCata00 if you can submit a PR it would be great! |
@fabiocaccamo Great!! Try to fix in this weekend |
Sorry, how can I start the project? Any docker or docker-compose file doesn't exists |
Man,I'm a Django developer in a Italy software house😅 |
Well you can’t expect people to guess your experience level! This project doesn’t have a demo app, so you have to write one to test the effect of changes, or rely on unit tests. |
Ohhh okay,really good point 🫶🏼 |
I tried to reproduce this bug, but the bug only appears if a custom theme is active... |
@FraCata00 all themes are handled by the same logic, the only things that can differ are their options, so I suppose that the theme that causes the problem has |
I also think that the problem is there, because it triggers that function by setting a custom theme |
I added that template tag, feel free to ask any question or tag me if you make a PR! |
Amazing work man, so I'd like to fix that when a custom theme is set |
This is how the date_hierarchy template tag gets the field object from a string: https://github.com/django/django/blob/main/django/contrib/admin/templatetags/admin_list.py#L356 The function used there must handle |
Exactly,I insert a try except with |
tomorrow after work i will try to see again |
date_hierarchy
on related fields in ForeignKey
doesn't work.
@FraCata00 any update? |
@fabiocaccamo sorry Sir, I've been very busy with work and I haven't been able to keep up with it.. this week I'm trying to finish something |
@FraCata00 fixed in |
@fabiocaccamo really good work! |
Python version
3.10.6
Django version
3.2.16
Package version
0.24.2
Current behavior (bug description)
if in modeladmin set the date_hierarchy with a field inside the ForeignKey, not work, maybe because not work the template_tags, so i read that inside this, search for the fields of Models, so the fk__fields is not a field of the chilld model
Expected behavior
?
The text was updated successfully, but these errors were encountered: