Created
April 12, 2018 13:10
-
-
Save karolyi/65c518c03630a540a4ecbe30f15b0a70 to your computer and use it in GitHub Desktop.
Register Length() to django queryset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models import CharField | |
from django.db.models.functions import Length | |
CharField.register_lookup(Length, 'length') | |
result = MyModel.objects.filter(text__length__gt=10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment