id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 26100 Queryset.extra use case: iregex against regular expressions stored as fields Jeff Johnson nobody "As requested, here is an example of something I couldn't figure out how to do without using Queryset.extra(). Given an email address, find all regular expressions from the database that match the email address. It would be like doing iregex in reverse. {{{ class EmailFilter(models.Model): regex = models.CharField(blank=False, max_length=128, db_index=True, help_text=""Do not send to email addresses that match this regular expression. Not case sensitive. E.g.: ^admin@.*$"") @classmethod def find_matching_rules(cls, email): return cls.objects.extra(where=['%s ~* regex'], params=[email]) }}} " Uncategorized closed Database layer (models, ORM) 1.9 Normal worksforme Queryset.extra Unreviewed 0 0 0 0 0 0