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.contrib.admin import ModelAdmin, register, SimpleListFilter | |
from django.db.models.functions import Length, StrIndex, Substr, NullIf, Coalesce | |
from django.db.models import Value as V | |
from .models import Item | |
class AlphanumericSignatureFilter(SimpleListFilter): | |
title = 'Signature (alphanumeric)' | |
parameter_name = 'signature_alphanumeric' |
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.contrib.admin import ModelAdmin, register | |
from django.db.models import IntegerField | |
from django.db.models.functions import Cast | |
from django.db.models.expressions import Func, Value | |
from .models import Foo | |
class RegexpMatches(Func): | |
function = 'REGEXP_MATCHES' |
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
import ast | |
import astor # read more at https://astor.readthedocs.io/en/latest/ | |
parsed = ast.parse(open('source.py').read()) | |
for node in ast.walk(parsed): | |
# let's work only on functions & classes definitions | |
if not isinstance(node, (ast.FunctionDef, ast.ClassDef, ast.AsyncFunctionDef)): | |
continue |
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
Can do it :) |
OlderNewer