Hello,
I'm trying to emulate a non-spaces-all-lower text comparison filter in
Django 1.6.x. In other words, I want the equivalent to this query
select * from myapp_mymodel where replace(lower(str), " ", "") =
'<user_entry>'
Being my model something like this
from django.db import models
class MyModel(models.Model):
num = models.IntegerField()
str = models.CharField(max_length=16)
In my mind, this can be implemented with a custom lookup like this:
MyModel.objects.filter(str__customcomparison='spaces and UPPERCASE will not
be taken into account')
I know Django 1.7 allows custom lookups creation, but can't make Django 1.6
work like this. I've tried implementing a custom QuerySet and a custom
Manager for MyModel. In the custom QuerySet, I override the method
_filter_or_exclude.
Am I in the right path? Any suggestion?
Many thanks in advance
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/041d82a9-531d-4817-a66d-5326f7996d1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.