Let's say I have a model with a string field similar to this
class Product(models.Model):
upc = models.CharField(max_length=12, blank=False, null=False)
Is it possible to build a model manager or something similar where every time I use Product.objects.get/Product.objects.filter it overrides the default lookup to force the search/filter to behave like I had used icontains?
As in:
Product.objects.get(upc="012345678902")
Product.objects.filter(upc="012345678902")
By default would behave like:
Product.objects.get(upc__icontains="012345678902")
Product.objects.filter(upc__icontains="012345678902")