How to filter data (queryset) in django admin interface by string length?
===

I would like to know, how to show only records where the 'code_key' length is 10 characters?

Currently if I use 'qs = Code.objects.filter(code_key.__len__()=10)' returns an error. 

Thanks in advance.

**admin.py**

    class CodeAdmin(admin.ModelAdmin):
        fields = ['code_key','redemption_date','user','movie']
        
        #
        list_display = ('code_key','redemption_date','user','movie')
        
        #
        search_fields = ('code_key','user__email','movie__title')
        
        def queryset(self, request):
            """
            Filter the objects displayed in the change_list
            """
            qs = super(CodeAdmin, self).queryset(request)
            return qs
    
        
        def changelist_view(self, request, extra_context=None):
            my_context = {
                'total': 'some value query',
            }
            return super(CodeAdmin, self).changelist_view(request,extra_context=my_context)

**models.py**

    class Code(models.Model):
        id = models.AutoField(primary_key=True)
        code_key = models.CharField(max_length=20,unique=True)
        redemption_date = models.DateTimeField(null=True, blank=True)
        user = models.ForeignKey(User, blank=True, null=True)
        movie = models.ForeignKey(Movie, blank=True, null=True)
        

        # ...
        def display_record(self):
            return (self.code_key.__len__() == 10)
        
        # ...
        def __unicode__(self):
            return self.code_key