I don't know if this is possible, but I think it would highly useful if it were.
Basically, I want to filter a DateField as though it were a string (see the StackOverflow post <http://stackoverflow.com/questions/36191609/how-can-i-filter-django-datefield-using-a-string> to understand why) If there was an option on a Q filter like this: Q(field__icontains="data", *T**ypeCheck=False*) ^^^^^^^^^^^^^^^^^^ (instructing Django to bypass type checking for this field) it would then be possible to do *datatype conversion on the database level*, allowing code like this to work from django.db.models import Lookupfrom django.db.models.fields import DateField @DateField.register_lookupclass DateTextFilter(Lookup): lookup_name = 'dttxt' def as_postgresql(self, compiler, connection): lhs, lhs_params = self.process_lhs(compiler, connection) rhs = self.rhs.strftime("%b %d, %Y") # this would be replaced by a partial date. e.g., 'Mar 05' return "to_char(%s,'Mon DD, YYYY') ~* '%s'", ([lhs,rhs]) Currently, this causes a ValidationError ValidationError: [u"'Mar 09' value has an invalid date format. It must be in YYYY-MM-DD format."] -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/f38f1e24-df0e-422f-a1c3-5105911a8ece%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.