Django

Code

Ticket #5115 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

ORM does not support query set subscription with long numbers

Reported by: zboczuch <zboczuch@paranoja.pl> Assigned to: adrian
Milestone: Component: Core framework
Version: SVN Keywords: orm query set slice indexing
Cc: zboczuch@paranoja.pl Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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.

Attachments

Change History

08/08/07 04:48:52 changed by zboczuch <zboczuch@paranoja.pl>

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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)):

08/08/07 04:55:48 changed by zboczuch <zboczuch@paranoja.pl>

  • cc set to zboczuch@paranoja.pl.

(follow-up: ↓ 5 ) 08/08/07 04:58:41 changed by zboczuch <zboczuch@paranoja.pl>

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

08/08/07 16:09:56 changed by gwilson

  • status changed from new to closed.
  • resolution set to fixed.

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

(in reply to: ↑ 3 ) 08/08/07 16:13:13 changed by gwilson

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.


Add/Change #5115 (ORM does not support query set subscription with long numbers)




Change Properties
Action