Fixed formatting - please use preview.
I have confirmed the problem as follows:
# todo/models.py
class Todo(models.Model):
summary = models.CharField(max_length=100, verbose_name=_('summary'))
details = models.TextField(blank=True, verbose_name=_('details'))
% ./manage.py shell
>>> from todo.models import *>>> from django.db.models import F
>>> Todo.objects.filter(details__startswith=F('summary'))
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "django/db/models/query.py", line 66, in __repr__
data = list(self[:REPR_OUTPUT_SIZE + 1])
File "django/db/models/query.py", line 81, in __len__
self._result_cache.extend(self._iter)
File "django/db/models/query.py", line 266, in iterator
for row in compiler.results_iter():
File "django/db/models/sql/compiler.py", line 699, in results_iter
for rows in self.execute_sql(MULTI):
File "django/db/models/sql/compiler.py", line 754, in execute_sql
cursor.execute(sql, params)
File "django/db/backends/util.py", line 34, in execute
return self.cursor.execute(sql, params)
File "django/db/backends/sqlite3/base.py", line 261, in execute
return Database.Cursor.execute(self, query, params)
DatabaseError: near "ESCAPE": syntax error
>>> from django.db import connection
>>> connection.queries
[{'time': '0.000', 'sql': u'SELECT "todo_todo"."id", "todo_todo"."summary", "todo_todo"."details" FROM "todo_todo" WHERE "todo_todo"."details" LIKE ESCAPE \'\\\' "todo_todo"."summary" LIMIT 21'}]