Hi. Is it possible to get a list of just the instance IDs of a specific class, instead of the entire list of objects?
I want to add a random picture component to an album app I'm building. So I have a class Picture. I want to choose ten to twenty random pictures out of all pictures submitted. Obviously, I don't want to load all Picture instances (potentially lots!) into memory just to do a random selection of a few. So, in pure SQL I would expect to just fetch a list of IDs, using a couple of search criteriam, whittle that down to my list of ten random IDs and then fetch just those objects. I haven't found a "get_ids()" method or similar, mirroring get_list() (including the selection criteria), which would allow me to do this. I *could* do a get_count(), generate a random ID based on that and fetch the objects. That would not be sufficient, though, because I want to do a random selection from a certain set of pictures (lets say 10 pictures out of the hundreds submitted by a specific user). Am I thinking too complicated? Would get_list() actually be the way to go? *Does* get_list actually fully load all instances into memory? Or what would be the best way to go about this? Daniel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---