Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#5115 closed (fixed)

ORM does not support query set subscription with long numbers

Reported by: zboczuch <zboczuch@…> Owned by: Adrian Holovaty
Component: Core (Other) Version: dev
Severity: Keywords: orm query set slice indexing
Cc: zboczuch@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

> from app.models import foo

> foo.objects.all()[2L]

<type 'exceptions.TypeError'> 

Longs are allowed in slices. I think the problem is in django/db/models/query.py:

{{
def getitem(self, k):

"Retrieve an item or slice from the set of results."
if not isinstance(k, (slice, int)):

}}

"long" should be added to the type list above.

Change History (5)

comment:1 by zboczuch <zboczuch@…>, 17 years ago

Hm... My mistake in formating:

def getitem(self, k):
    "Retrieve an item or slice from the set of results."
    if not isinstance(k, (slice, int)):

comment:2 by zboczuch <zboczuch@…>, 17 years ago

Cc: zboczuch@… added

comment:3 by zboczuch <zboczuch@…>, 17 years ago

Ooops! This ticket system shows my email to everyone. Is there a possibility to hide it?

comment:4 by Gary Wilson, 17 years ago

Resolution: fixed
Status: newclosed

(In [5831]) Fixed #5115 -- Fixed QuerySet slices to allow longs.

in reply to:  3 comment:5 by Gary Wilson, 17 years ago

Replying to zboczuch <zboczuch@paranoja.pl>:

Ooops! This ticket system shows my email to everyone. Is there a possibility to hide it?

I could remove your email from the ticket description and cc, but I don't think I could do anything about the comments.

Note: See TracTickets for help on using tickets.
Back to Top