#198 closed enhancement (fixed)
istartswith doesn't work
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Contrib apps | Version: | magic-removal |
Severity: | critical | Keywords: | database lookup |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
istartswith is not working.
Change History (7)
comment:1 by , 19 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:3 by , 19 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
Maybe I'm using it incorrectly? I'm using mysql, and mod_python.
Here's my code:
def card_detail(request, name=None): try: card = cards.get_object(name__istartswith=name) except cards.CardDoesNotExist: return Render(request, 'message', {'message': 'Cannot find a card with the name, %r' % name}) return Render(request, 'card', {'card': card})
Here's my output:
There's been an error: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py", line 63, in get_response return callback(request, **param_dict) File "/home/deadwisdom/sites/magic/views/magic.py", line 18, in card_detail card = cards.get_object(name__istartswith=name) File "/usr/lib/python2.4/site-packages/django/core/meta.py", line 87, in _curried return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items())) File "/usr/lib/python2.4/site-packages/django/core/meta.py", line 1032, in function_get_object obj_list = function_get_list(opts, klass, **kwargs) File "/usr/lib/python2.4/site-packages/django/core/meta.py", line 1054, in function_get_list select, sql, params = function_get_sql_clause(opts, **kwargs) File "/usr/lib/python2.4/site-packages/django/core/meta.py", line 1231, in function_get_sql_clause tables2, join_where2, where2, params2, _ = _parse_lookup(kwargs.items(), opts) File "/usr/lib/python2.4/site-packages/django/core/meta.py", line 1214, in _parse_lookup params.extend(f.get_db_prep_lookup(lookup_type, kwarg_value)) File "/usr/lib/python2.4/site-packages/django/core/meta.py", line 1649, in get_db_prep_lookup raise TypeError, "Field has invalid lookup: %s" % lookup_type TypeError: Field has invalid lookup: istartswith
comment:5 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:6 by , 18 years ago
Component: | Database wrapper → Contrib apps |
---|---|
milestone: | → Version 0.91 |
priority: | normal → low |
Severity: | normal → critical |
Type: | defect → enhancement |
Version: | → magic-removal |
Note:
See TracTickets
for help on using tickets.
Brantley: it works for me, so please try again and if you're still having problems reopen this ticket with more information about exactly what's not working.