...
class Meta:
managed = False
db_table = 'orders'
def GetNumOrder(self, idOrder):
from django.db import connection
cursor = connection.cursor()
cursor.execute("SELECT getordernum(%s) as id", [idOrder])
row = cursor.fetchone()
return row[0]