My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 79: tree.add_related_count throws an AttributeError: 'str' object has no attribute 'extra'
  Back to list
Status:  New
Owner:  ----


 
Reported by dominikB...@gmail.com, Dec 1, 2010
What steps will reproduce the problem?
1. node = ContentBox.objects.get(id=1)
2. tree_with_nodes =  ContentBox.tree.add_related_count(node.get_children(), ContentBox, "parent", "cat_count", cumulative=True)
3.

What is the expected output? What do you see instead?
the expected output is a list of child ContentBoxes which have a cat_count attribute containing the number of ContentBoxes associated with each of them

What version of the product are you using? On what operating system?
I use the latest version of django-mptt

Please provide any additional information below.

the output :



E
======================================================================
ERROR: test_project (wf.tests.TestProject)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/me/Projects/project/wf/tests.py", line 200, in test_project
    tree_with_nodes =  ContentBox.tree.add_related_count(node.get_children(), ContentBox, "parent", "nodes_count", cumulative=True)
  File "/usr/local/lib/python2.6/dist-packages/django_mptt-0.5.pre-py2.6.egg/mptt/managers.py", line 153, in add_related_count
    return queryset.extra(select={count_attr: subquery})
AttributeError: 'str' object has no attribute 'extra'

----------------------------------------------------------------------
Ran 1 test in 0.029s

FAILED (errors=1)


Powered by Google Project Hosting