I'm using this function to load Django objects using custom sql --- def get_objects_by_sql(klass, query, query_data=[]): """Return objects using model class and query which returns object id set.
First column returned by query will be used as object id for lookup""" cur = connection.cursor() cur.execute(query, query_data) oid_list = [row[0] for row in cur.fetchall()] obj_list = klass._default_manager.in_bulk(oid_list) return [obj_list[oid] for oid in oid_list] --- On Feb 5, 5:48 pm, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > hey everyone, > > * is there a way to do custom queries, and tie the result back into the > object model or into the queryset interface? I have a query which > (really) returns 'django objects', which is impossible to write with the > ORM, but after doing the query I would like to get back to using django > objects. > > * (very) related to this, is there any way to use the paginator with > custom SQL queries? > > - bram --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---