On Sep 1, 7:13 pm, Djn <[EMAIL PROTECTED]> wrote: > I'm in the process of moving an existing app over to python and > Django, and ran into one snag I haven't been able to find any comments > on. > > Basically, I have objects that describe themselves as an SQL-style > pattern (they represent small chunks of possible patterns from DNA, so > things like "GTGCGG_[AT]"). There's also a table with a word field, > and I'd like to do the equivalent of "SELECT * FROM word_genome WHERE > word LIKE 'GTGCGG_[AT]' . > > Is there any way to either turn autoescaping off for single queries > (which would make it trivial to mangle __contains or something to work > for me), or have I overlooked any other obvious possibilities? > > Rewriting to use __regex is possible, but I'd rather avoid it. >
I found a solution, so I'll just reply to myself in case someone finds this post later and wonders. The answer is indeed another obvious possibility: The .extra() method in the model class is made for things like this. To be exact, wordGenome.objects.extra(where=[ "word like 'GTGCGG_[AT]'"]) does what I needed. -- Daniel Nebdal Student, IFI/UiO --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---