MyModel.objects.extra(where=["replace(db_column_name, '''', '') = %s"], params=["rockn burger"])
(Be careful if you're typing that in manually -- there are lots of single-quotes in it)
Ian
On Fri, Jul 20, 2012 at 4:02 PM, Ada Pineda <elizethpineda@gmail.com> wrote:
HelloI'm asking for your help because I need to do a query on a table that has a field that contains apostrophes, but I need to ignore them (apostrophes) when I'm doing the query. I have to save the data as it is, so I can't just take away those apostrophes before saving to the database. I mean, if the database has "rock'n burger" and a user types "rockn burger", I need to get the value with apostrophe from the database.Can anyone help me?Thanks a lot!--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/lxGzVjrwQgMJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Regards,
Ian Clelland
<clelland@gmail.com>
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment