On 2010-02-04, at 7:36 AM, harryos wrote: > In the shell I tried this > from django.shortcuts import get_object_or_404 as gtobj > e1=gtobj(MyEntry,posted_time__year=2010,posted_time__month=2,posted_time__day=1) > This is successful ,it gives this message > MultipleObjectsReturned: get() returned more than one MyEntry -- it > returned 4!
get(..) assumes there's one and only one object, hence the error. > However when I tried , > e1=gtobj(MyEntry,posted_time__year=2010,posted_time__month=2,posted_time__day=1,posted_time__hour=10) > > I get this error, > FieldError: Join on field 'posted_time' not permitted. Did you > misspell 'hour' for the lookup type? There are lookups for year, month and day as documented here: http://docs.djangoproject.com/en/dev/ref/models/querysets/#year But *not* hour or minute. -- Andy McKay, @clearwind http://clearwind.ca/djangoski -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

