Hi,

I have in my database quite a bunch of a models where I do have quite large fields and I'm using .only('pk', 'identifier') to fetch only those two fields - mainly to make serverside natural sort for a data. Database is legacy one and it's being used with other external programs as well so changing it is not possible.

After sorting I just need to get slice of data and fetch rest of fields in one query. I haven't found simple way to fetch rest of the fields in one request.

So what I would like to do:

qs = MyModel.objects.all().only('pk', 'identifier')

list_of_models = sort_naturally(qs, 'identifier')

sublist_of_models = list_of_models[10:20]

for model in sublist_of_models:
    model.fetch_all_deferred_fields()



--
Jani Tiainen

- Well planned is half done and a half done has been sufficient before...

--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to