On 8/31/06, Jakub Labath <[EMAIL PROTECTED]> wrote: > > Hi, > > Thanks for advice Malcolm! > > I feel a sample would save some time to other people. Time that i had to > spend. > > class OnlyRealProfileSQL: > def get_sql(*args): > #select name from django_content_type where app_label = > 'users' and model != 'profile' and model like '%p > rofile' > return ({}, ['"django_content_type"."model" LIKE %s', > '"django_content_type"."app_label" = > %s','"django_content_type"."model" != %s'], ['%profile', > 'users','profile'])
Thanks for the sample. The only thing I'd add is that, if your custom Q object may be combined with other Q objects in the same query, Django will raise a TypeError. To avoid this, you your Q object should extend Django's Q object: class OnlyRealProfileSQL(Q): def get_sql(*args): # and so forth... Alan -- Alan Green [EMAIL PROTECTED] - http://bright-green.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---