Django filter: datetime filed

Pease help me with next. I create NotesFilter based on django_filters.FilterSet. All filters is working except datetime. I trying everything, but something wrong and it doesn't working. List is empty when i enter any value in any format in field "Reminder contains:"

filter.py:

class NotesFilter(django_filters.FilterSet):

SORT_BY_ = (
    ('title+', 'Title(A-Z)'),
    ('title-', 'Title(Z-A)'),
    ('reminder_data_time+', 'Reminder (0-9)'),
    ('reminder_data_time-', 'Reminder (9-0)'),
)

sort = django_filters.ChoiceFilter(label='Order by:', choices=SORT_BY_,
                                   method='filter_')
class Meta:
    model = Notes
    fields = {
        'notes_category': ['exact', ],
        'title': ['icontains', ],
        'reminder_data_time': ['icontains',]
    }

def filter_(self, queryset, name, value):
    if value == 'title+':
        sort = 'title'
    elif value == 'title-':
        sort = '-title'
    elif value == 'reminder_data_time+':
        sort = 'reminder_data_time'
    elif value == 'reminder_data_time-':
        sort = '-reminder_data_time'
    return queryset.order_by(sort)

models.py:

class Notes(models.Model):
title = models.CharField(max_length=25)
text = models.TextField()
data_time = models.DateTimeField(auto_now_add=True)
reminder_data_time = models.DateTimeField(default=datetime.datetime.now())
notes_category = models.ForeignKey(NotesCategory, on_delete=models.CASCADE)

class Meta:
    verbose_name_plural = "Notes"

def __repr__(self):
    return self.title

def __str__(self):
    return self.title

def get_absolute_url(self):
    return reverse('detail_note', args=[str(self.id)])

notes.html:

    [![<form method="get">
{% for choice in filter.form %}

{%  if choice.name == 'notes_category' %}
    <td>Category: {{ choice }}</td>
{%  elif choice.name == 'title__icontains' %}
    <td>Title contains: {{ choice }}</td>
    {%  elif choice.name == 'reminder_data_time__icontains' %}
    <td>Reminder contains: {{ choice }}</td>
    {%  elif choice.name == 'sort' %}
    <td>Sort by: {{ choice }}</td>
    <td> <div class="btn-small-group">
                <button type="submit">
                    <img src="{% static 'notes/images/search.png' %}" width="25" height="25">
                </button>
            </div></td>

{%  endif %}
{% endfor %}

 </form>]

Screenshot

Back to Top