Hey everyone,
   I came across the need today to use something like
MyModel.objects.filter(date__month__gte=9).  However, that doesn't
work:
>>> ContactEvent.objects.filter(date__month__gte=9)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/share/djangos/django-trunk/django/db/models/
manager.py", line 129, in filter
    return self.get_query_set().filter(*args, **kwargs)
  File "/usr/local/share/djangos/django-trunk/django/db/models/
query.py", line 466, in filter
    return self._filter_or_exclude(False, *args, **kwargs)
  File "/usr/local/share/djangos/django-trunk/django/db/models/
query.py", line 484, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))
  File "/usr/local/share/djangos/django-trunk/django/db/models/sql/
query.py", line 1635, in add_q
    can_reuse=used_aliases)
  File "/usr/local/share/djangos/django-trunk/django/db/models/sql/
query.py", line 1533, in add_filter
    negate=negate, process_extras=process_extras)
  File "/usr/local/share/djangos/django-trunk/django/db/models/sql/
query.py", line 1843, in setup_joins
    raise FieldError("Join on field %r not permitted. Did you misspell
%r for the lookup type?" % (name, names[pos + 1]))
FieldError: Join on field 'date' not permitted. Did you misspell
'month' for the lookup type?

I can achieve what I want using extra(), but I thought I'd ask how (im)
possible it would be to make my desired functionality work.   The SQL
(on postgres, at least) difference between filter(date__month=9) and
filter(date__month__gt=9) is a single character, but I realize that
has little do to with what it would take to get Django to do that.

thanks
Jay
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to