title: Django admin add list_filter based on custom field
body: <p>I am trying to create a custom list_filter in django admin. The custom field works just fine in the admin but when i add it to the list_filter i get <code>ERRORS: &lt;class 'whosnext.admin.WhosNextTrackingAdmin'&gt;: (admin.E116) The value of 'list_filter[1]' refers to 'get_is_different', which does not refer to a Field.</code></p>
  <p>I created a custom SimpleListFilter to handle this but it also says <code>ERRORS: &lt;class 'whosnext.admin.WhosNextTrackingAdmin'&gt;: (admin.E116) The value of 'list_filter[1]' refers to 'MatchedNamesFilter', which does not refer to a Field.</code></p>
  <p>I am wondering how I can create a list_filter for this custom field. Code is as follows (all in admin.py).</p>
  <p>Django 3.2.3</p>
  <pre><code>class MatchedNamesFilter(admin.SimpleListFilter):
      title = &quot;Matched Status&quot;
      parameter_name = &quot;get_is_different&quot;
      
      def lookups(self, request, model_admin):
          return [(
              (&quot;matched&quot;, &quot;Matched&quot;),
              (&quot;not_matched&quot;, &quot;Not Matched&quot;),
              (&quot;na&quot;, &quot;N/A&quot;)
          )]
      
      def queryset(self, request, queryest):
          if self.value() == &quot;matched&quot;:
              return queryest.distinct().filter(get_is_different=&quot;Matched&quot;)
          if self.value() == &quot;not_matched&quot;:
              return queryest.distinct().filter(get_is_different=&quot;Does Not Match&quot;)
          if self.value() == &quot;na&quot; or self.value == None:
              return queryest.distinct().filter(get_is_different__isnull=True)
  
  @admin.register(WhosNextTracking)
  class WhosNextTrackingAdmin(admin.ModelAdmin):
      list_display = ['tsa', 'date_time_clicked', 'get_case_number', 'get_triage_failed', 'who_was_picked', 'who_case_was_actually_assigned_to', 'get_is_different']
      list_filter = [('date_time_clicked', DateFieldListFilter), 'get_is_different']
      search_fields = ['tsa', 'who_was_picked', 'get_case_number', 'who_case_was_actually_assigned_to']
  
  
  
    def get_case_number(self, obj):
          case_number = eval(obj.case_details)['case_number']
          return case_number
      get_case_number.admin_order_field = 'case_number'
      get_case_number.short_description = 'Case Number'
      
      def get_triage_failed(self, obj):
          triage_failed = eval(obj.triage_result)['Error']
          if triage_failed:
              return format_html(triage_failed)
          else:
              return &quot;Successful&quot;
      get_triage_failed.admin_order_field = 'triage_failed'
      get_triage_failed.short_description = 'Triage Failed'
          
      def get_is_different(self, obj):
          if obj.original_owner_set:
              if obj.who_was_picked == obj.who_case_was_actually_assigned_to:
                  return &quot;Matched&quot;
              else:
                  return &quot;Does Not Match&quot;
          else:
              return &quot;N/A&quot;
      get_is_different.admin_order_field = 'get_is_different'
      get_is_different.short_description = 'Triage Matched Assignee'
  </code></pre>
  <p>Thanks</p>