<commit_before>from atom.ext.django_filters.filters import CrispyFilterMixin
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Div, Fieldset, Layout, Submit
from django.utils.translation import ugettext_lazy as _
import django_filters

from poradnia.users.filters import UserChoiceFilter

from .models import Advice


class AdviceFilter(CrispyFilterMixin, django_filters.FilterSet):
    name = django_filters.CharFilter(
        label=_("Subject"),
        lookup_expr='icontains'
    )
    advicer = UserChoiceFilter(label=_("Advicer"))
    created_by = UserChoiceFilter(label=_("Created by"))
    created_on = django_filters.DateRangeFilter(label=_("Created on"))

    class Meta:
        model = Advice
        fields = ['advicer', 'created_by', 'created_on',
                  'area', 'issues', 'person_kind', 'institution_kind', 'helped', 'subject']
        order_by = (<commit_msg>Fix filtering by subject<commit_after>from atom.ext.django_filters.filters import CrispyFilterMixin
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Div, Fieldset, Layout, Submit
from django.utils.translation import ugettext_lazy as _
import django_filters

from poradnia.users.filters import UserChoiceFilter

from .models import Advice


class AdviceFilter(CrispyFilterMixin, django_filters.FilterSet):
    subject = django_filters.CharFilter(
        label=_("Subject"),
        lookup_expr='icontains'
    )
    advicer = UserChoiceFilter(label=_("Advicer"))
    created_by = UserChoiceFilter(label=_("Created by"))
    created_on = django_filters.DateRangeFilter(label=_("Created on"))

    class Meta:
        model = Advice
        fields = ['advicer', 'created_by', 'created_on',
                  'area', 'issues', 'person_kind', 'institution_kind', 'helped', 'subject']
        order_by = (
{'fraction_non_alphanumeric': 0.10010881392818281, 'fraction_numerical': 0.0, 'mean_word_length': 4.37719298245614, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4122456', 'n_tokens_mistral': 533, 'n_tokens_neox': 538, 'n_words': 123}