Django filter Max 구하기

2021. 3. 27. 12:52파이썬/Django

from django.db.models import Max

name = Tested_Data.objects.filter(name__contains=lang).aggregate(name=Max('name'))
print(name)
print(name['name'])

결과

{'name': './aaa/aa/222'}
./aaa/aa/222

'파이썬 > Django' 카테고리의 다른 글

Django union  (0) 2021.03.27
Django filter 정규식  (0) 2021.03.27
Django get_or_create  (0) 2021.03.11
Django django.db.utils import OperationalError  (0) 2021.03.10
unsupported operand type(s) for -: 'NoneType' and 'NoneType'  (0) 2021.03.07