Debe usar SQL personalizado en lugar de Manager.raw()
método:
from django.db import connection
cursor = connection.cursor()
cursor.execute('SELECT max(value) FROM mytable')
max_value = cursor.fetchone()[0]
Debe usar SQL personalizado en lugar de Manager.raw()
método:
from django.db import connection
cursor = connection.cursor()
cursor.execute('SELECT max(value) FROM mytable')
max_value = cursor.fetchone()[0]