Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception with invalid sort GET variable #5

Open
glezos opened this issue Aug 18, 2009 · 2 comments
Open

Exception with invalid sort GET variable #5

glezos opened this issue Aug 18, 2009 · 2 comments

Comments

@glezos
Copy link

glezos commented Aug 18, 2009

The following URL raises an exception: ?sort=foo. One would expect this would be caught and simply ignored.

Exception Type: TemplateSyntaxError at /projects/usermode/log/
Exception Value: Caught an exception while rendering: Cannot resolve keyword u'foo' into field. Choices are: action_time, action_type, content_type, id, message, object_id, object_name, user

Original Traceback (most recent call last):
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/template/debug.py", line 71, in render_node
    result = node.render(context)
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/template/defaulttags.py", line 244, in render
    if (value and not ifnot) or (ifnot and not value):
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/query.py", line 191, in __nonzero__
    iter(self).next()
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/query.py", line 185, in _result_iter
    self._fill_cache()
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/query.py", line 618, in _fill_cache
    self._result_cache.append(self._iter.next())
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/query.py", line 275, in iterator
    for row in self.query.results_iter():
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/sql/query.py", line 206, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/sql/query.py", line 1724, in execute_sql
    sql, params = self.as_sql()
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/sql/query.py", line 261, in as_sql
    ordering = self.get_ordering()
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/sql/query.py", line 656, in get_ordering
    self.model._meta, default_order=asc):
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/sql/query.py", line 684, in find_ordering_name
    opts, alias, False)
  File "/home/mits/devel/envs/current/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/sql/query.py", line 1321, in setup_joins
    "Choices are: %s" % (name, ", ".join(names)))
FieldError: Cannot resolve keyword u'foo' into field. Choices are: action_time, action_type, content_type, id, message, object_id, object_name, user
@lukaszb
Copy link

lukaszb commented Jun 9, 2010

bump

is there any change that this project would be continued or should community roll another app?

@camilonova
Copy link

This problem also happens to me.

This project is active?

mlavin added a commit to mlavin/django-sorting that referenced this issue Jun 5, 2011
… prevents the user from sorting on a field which we have not provided for them as an option. Raising Http404 inside a template tag doesn't work anyway. See directeur#5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants