django-unfold icon indicating copy to clipboard operation
django-unfold copied to clipboard

RangeDateTimeFilter templete not show date picker

Open vahidtwo opened this issue 1 year ago • 6 comments

Hi i use the unfould RangeDateTimeFilter for filtering datetime field when i use RangeDateFilter the date picker work fine but when i use RangeDateTimeFilter the datepicker not work

@admin.register(models.Fooo)
class FoooAdmin(BaseAdminModelClass):

    list_filter = [
    ...
        ("created_at", RangeDateTimeFilter),
    ]

screanshot image

image

as you see in screenshots when i click on edit, the time filter show up

versions

Django==3.2.20
djangorestframework==3.13.1
django-extensions==3.1.5
django-admin-rangefilter==0.12.0
django-admin-autocomplete-filter==0.7.1
django-cors-headers==3.13.0
django-import-export==3.2.0
django-unfold==0.17.1

vahidtwo avatar Jan 03 '24 07:01 vahidtwo

I noticed you install django-admin-rangefilter.

rangefilter could override unfold's template. Are you using both at the same time?

jrobichaud avatar Mar 14 '24 15:03 jrobichaud

yes @jrobichaud as you see on myversion section i sed the actual version of my packages. what should i do sir?

vahidtwo avatar Mar 14 '24 15:03 vahidtwo

I never used unfold but I used rangefilter. I was checking the issues to see if it would be compatible with my project, and your issue stood out to me.

Is there a reason you use rangefilter instead of unfold's range filters?

From unfold's readme:

# admin.py

from django.contrib import admin
from django.contrib.auth.models import User

from unfold.admin import ModelAdmin
from unfold.contrib.filters.admin import (
    RangeDateFilter,
    RangeDateTimeFilter,
)


@admin.register(User)
class YourModelAdmin(ModelAdmin):
    list_filter_submit = True  # Submit button at the bottom of the filter
    list_filter = (
        ("field_E", RangeDateFilter),  # Date filter
        ("field_F", RangeDateTimeFilter),  # Datetime filter
    )

I would not be surprised they cannot be used together.

My first guess would be to replace the range filters and then remove rangefilter. Having "rangefilter" in the INSTALLED_APPS could result of unintended template overrides, make sure you remove all traces of it.

As I never used unfold I could be totally wrong.

jrobichaud avatar Mar 14 '24 16:03 jrobichaud

the unfold datetime filter utility is not my expected result for filtering data

vahidtwo avatar Mar 14 '24 17:03 vahidtwo

Oh, I understand the point. Maybe you could rename your issue for something like:

"django-admin-rangefilter" compatibility

jrobichaud avatar Mar 14 '24 17:03 jrobichaud

out of curiosity, what is not expected?

jrobichaud avatar Mar 14 '24 17:03 jrobichaud

@vahidtwo Unfold has its own range filter. Please check docs for more info.

lukasvinclav avatar May 03 '24 17:05 lukasvinclav

@lukasvinclav Hi, I am experiencing this issue as well. I have double checked for any conflicting filter libraries and can confirm there are none.

RangeDateFilter works fine, but RangeDateTimeFilter does not allow a date selection:

image

When clicking the first icon on the left, I get this:

image

And when clicking the stopwatch icon, it sets the time only, not the date:

image

EDIT: Adding django and related lib info below:

root@607cf12ec1c2:/app# pip freeze | grep -i django
Django==4.1.13
django-crum==0.7.9
django-dry-rest-permissions==1.2.0
django-extensions==3.2.3
django-rq==2.7.0
django-storages==1.13.2
django-unfold==0.26.0
djangorestframework==3.15.1
pytest-django==4.5.2

muhammedabad avatar Jun 03 '24 14:06 muhammedabad

@lukasvinclav Hi, I am experiencing this issue as well. I have double checked for any conflicting filter libraries and can confirm there are none.

RangeDateFilter works fine, but RangeDateTimeFilter does not allow a date selection:

image

When clicking the first icon on the left, I get this:

image

And when clicking the stopwatch icon, it sets the time only, not the date:

image

EDIT: Adding django and related lib info below:

root@607cf12ec1c2:/app# pip freeze | grep -i django
Django==4.1.13
django-crum==0.7.9
django-dry-rest-permissions==1.2.0
django-extensions==3.2.3
django-rq==2.7.0
django-storages==1.13.2
django-unfold==0.26.0
djangorestframework==3.15.1
pytest-django==4.5.2

me too,I also encountered this problem。

jtzgyw avatar Jul 23 '24 09:07 jtzgyw