I'm starting to think I should just email you directly with my problems, Malcom :D Thanks a lot - I've done that sort of thing before, but just wasn't thinking of it, it's definitely a fine stopgap solution.
Since you seem to agree about adding the method to QuerySets in general, I'll throw a quick ticket/patch into Trac so it's there - would've done so initially but wasn't entirely sure if it was appropriate. Regards, Jeff On Mar 15, 5:43 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2007-03-15 at 21:17 +0000, Jeff Forcier wrote: > > [...] > > > The problem is that QuerySets are not Managers, and so I will find > > myself mucking with these objects in various spots and not knowing > > offhand whether a given relationship attribute has e.g. the .all() > > method, or not. If it's a regular Manager, and I want the entire set, > > I must do myobj.relateditem_set.all(). If it's one of my custom > > methods, that syntax will break as QuerySets do not have .all(). > > > All I really want is the ability to have these extra faux-Manager > > methods and for them to be indistinguishable in normal usage from the > > real Managers. Any ideas? I'm unsure if it's wise to give QuerySets > > a .all() method that simply returns 'self', although that would bring > > the two object types closer together interface-wise. > > It's not an insane idea. Certainly worth thinking about. > > In the interim, you can work around this for your own purposes by > shoving an all() method into the QuerySet just before you return it from > each of your methods. Adds two lines of code each time, but doesn't > require touching the Django source. I'm thinking about something like: > > queryset = .... # whatever magic is required > queryset.all = lambda self: return self > return queryset > > Regards, > Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---