Hi Mike, > I am working on a django that querys long distance numbers from a > mysql database. I am currently using the django API, that goes > something like this. > > long_distance = > Call.objects.filter(dest_num__startswith='1').filter(dest_num__gt=6).exclude(dest_num__startswith='18').exclude(dest_num__startswith='1281').exclude(dest_num__startswith='1832').exclude(dest_num__startswith='1713') > > I was hoping to consolidate all of my .filter excludes into one regex. > is this possible and would it be more efficient? Basically any number > that doesnt start with 281,713,832 or 1281,1713,or 1832 is long > distance any help would be appreciated.
If you have the ability to change your Call model, you should consider adding a new BooleanField called "is_long_distance" to Call. Then, you only have to compute it (in Call.save()) when you save or change a number. That will make your query very simple and efficient. -Rajesh D --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---