Opened 11 years ago

Closed 11 years ago

#19575 closed Bug (invalid)

1.5rc breaks custom querysets (at least in my case)

Reported by: anonymous Owned by: nobody
Component: Uncategorized Version: 1.5-beta-1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

A custom queryset that was working through 1.5b2 breaks under rc1. I keep getting "'AuthQuerySet' object has no attribute '_known_related_objects'" when trying to invoke methods on a class that uses the queryset.

I've confirmed that I do not get the error in b2 but do get the error in rc1 - so I'm comfortable stating that something changed for the worse between b2 and rc1.

I'm really sorry this is so vague, but I don't understand the error message, and I don't know what code to post. I'd be happy to chat with someone on IRC about it though, and I can run any tests suggested.

Perhaps it's related to https://github.com/django/django/pull/617 ?

Attachments (1)

foo (2.1 KB ) - added by anonymous 11 years ago.
traceback without formatting.

Download all attachments as: .zip

Change History (6)

comment:1 by anonymous, 11 years ago

Here's a traceback in case it helps:

Environment:

Request Method: GET
Request URL: http://localhost:8000/kml/devices/testfilter/

Django Version: 1.5c1
Python Version: 2.7.2
Installed Applications:
('django.contrib.auth',

'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'mvw',
'django.contrib.admin',
'django.contrib.admindocs',
'django_tables2',
'django.contrib.gis',
'debug_toolbar')

Installed Middleware:
('django.middleware.common.CommonMiddleware',

'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware')

Traceback:
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py" in get_response

  1. response = callback(request, *callback_args, callback_kwargs)

File "/Users/project1/code/mvw/mvw/decorators.py" in wrap

  1. return f(request, *args, kwargs)

File "/Users/project1/code/mvw/mvw/views.py" in kmldevices

  1. filter.graph = filter._build_graph()

File "/Users/project1/code/mvw/mvw/models/filter.py" in _build_graph

  1. for p in self.packets.filter(packettypename = 'RSP'):

File "/Users/project1/code/mvw/mvw/models/filter.py" in packets

  1. query = query.authfilter(self.user)

File "/Users/project1/code/mvw/mvw/models/managers.py" in authfilter

  1. return self.filter(probeclientuser_set = user)

File "/Library/Python/2.7/site-packages/django/db/models/query.py" in filter

  1. return self._filter_or_exclude(False, *args, kwargs)

File "/Library/Python/2.7/site-packages/django/db/models/query.py" in _filter_or_exclude

  1. clone = self._clone()

File "/Library/Python/2.7/site-packages/django/db/models/query.py" in _clone

  1. c._known_related_objects = self._known_related_objects

Exception Type: AttributeError at /kml/devices/testfilter/
Exception Value: 'AuthQuerySet' object has no attribute '_known_related_objects'

comment:2 by Alex Gaynor, 11 years ago

We need a bit more information, specifically we need some code that allows us to reproduce this. To a first approximation, it sounds like you aren't calling super in your queryset's __init__ method.

by anonymous, 11 years ago

Attachment: foo added

traceback without formatting.

in reply to:  2 comment:3 by anonymous, 11 years ago

Replying to Alex:

We need a bit more information, specifically we need some code that allows us to reproduce this. To a first approximation, it sounds like you aren't calling super in your queryset's __init__ method.

I get it. Unfortunately, due to the nature of the code, I can't really post it publicly. I'm not overriding init in the queryset.

Is there another way I can share code with someone privately?

comment:4 by anonymous, 11 years ago

OK, thanks to some cool folks on IRC, I think we've figured this out.

There was a change made to the name of a QuerySet attribute from "_known_related_object" to "_known_related_objects" (see https://github.com/django/django/commit/07fbc6ae0e3b7742915b785c737b7e6e8a0e3503#django/db/models/query.py).

This resulted in previously-pickled querysets in my app to fail since they had the old attribute.

comment:5 by anonymous, 11 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top