Issue #2 new

related_name problem on Projects.sites field

seanb
created an issue

I may be missing something here, but ...

Traversing the Project.sites relationship has some problem i don't understand.

Details:

we have a project defined

proj = pend.Project.objects.get() proj <Project: Test Project>

it has a 'sites' attribute

dir(proj) ['DoesNotExist', 'MultipleObjectsReturned', '_Projectdescription', '_Projecttotal_hours', 'class', 'delattr', 'description', 'dict', 'doc', 'eq', 'format', 'getattribute', 'hash', 'init', 'metaclass', 'module', 'ne', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'unicode', 'weakref', '_base_manager', '_default_manager', '_deferred', '_get_FIELD_display', '_get_next_or_previous_by_FIELD', '_get_next_or_previous_in_order', '_get_pk_val', '_get_unique_checks', '_meta', '_perform_date_checks', '_perform_unique_checks', '_set_pk_val', '_state', 'clean', 'clean_fields', 'date_added', 'date_error_message', 'date_updated', 'delete', 'description', 'entries', 'full_clean', 'get_next_by_date_added', 'get_next_by_date_updated', 'get_previous_by_date_added', 'get_previous_by_date_updated', 'id', 'is_active', 'log_count', 'name', 'objects', 'owner', 'owner_id', 'pk', 'prepare_database_save', 'save', 'save_base', 'serializable_value', 'sites', 'total_hours', 'unique_error_message', 'validate_unique']

the sites attribute seems to be the right kind of object

proj.sites <django.db.models.fields.related.ManyRelatedManager object at 0x04867D70>

but collecting its values breaks somewhere deep in the query process

proj.sites.all() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\Python26\lib\site-packages\django\db\models\manager.py", line 117, in all return self.get_query_set() File "c:\Python26\lib\site-packages\django\db\models\fields\related.py", line 497, in get_query_set return superclass.get_query_set(self).using(db)._next_is_sticky().filter((self.core_filters)) File "c:\Python26\lib\site-packages\django\db\models\query.py", line 550, in filter return self._filter_or_exclude(False, *args, kwargs) File "c:\Python26\lib\site-packages\django\db\models\query.py", line 568, in _filter_or_exclude clone.query.add_q(Q(args, *kwargs)) File "c:\Python26\lib\site-packages\django\db\models\sql\query.py", line 1172, in add_q can_reuse=used_aliases, force_having=force_having) File "c:\Python26\lib\site-packages\django\db\models\sql\query.py", line 1060, in add_filter negate=negate, process_extras=process_extras) File "c:\Python26\lib\site-packages\django\db\models\sql\query.py", line 1238, in setup_joins "Choices are: %s" % (name, ", ".join(names))) django.core.exceptions.FieldError: Cannot resolve keyword 'project' into field. Choices are: domain, id, name

We're running Python 2.6.6 and Django 1.3, with the various requirements listed on http://pypi.python.org/pypi/django-pendulum/ in place.

Edit: i see the format gets a little mangled, so i've attached a plain text file that may be more readable.

Comments (1)

  1. Log in to comment