Issue 74: If a forum has multiple groups assigned to it managers.ForumManager.for_groups returns an instance of the forum for each group that has access. This causes the views.forum to raise a MultipleObjectsReturned
Status:  Fixed
Owner:
Closed:  Aug 2009
Reported by jamie.cu...@gtempaccount.com, Aug 10, 2009
What steps will reproduce the problem?
1. Create a forum
2. Assign access to multiple groups
3. Visit forum list ( should see an instance of the forum for each group that has access ) 
4. click on one of the returned forums and a MultipleObjectsReturned exception should be raised

What is the expected output? What do you see instead?

I would expect that if a user has access to a forum, then only one instance of the forum is return.

What version of the product are you using? On what operating system?

OS : OSX 10.5.7
Python : Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12) 
Django : Django version 1.1 SVN-11385
forum :  ( was revsion 45, but I customised it locally as I needed to deploy it with 1.1 before the recent updates to 
the project.

Please provide any additional information below.

The fix is quite simple .. 
>>> change line 9 managers.py from
            return self.filter(public|user_groups)
>>> to
            return self.filter(public|user_groups).distinct()

Apologies about not submitting a proper patch - I don't know how to yet!
managers.py
445 bytes   View   Download
Aug 10, 2009
#1 jamie.cu...@gtempaccount.com
I'm also new to testing, but I've attached a zip containing some fixtures and some rudimentary tests that catch 
this error.
django-forum.zip
3.7 KB   Download
Aug 12, 2009
#2 byme...@gmail.com
Hi! To submit a patch it's just:
$ diff -Naur old_file new_file > file.patch

That's it!
Aug 12, 2009
#3 jamie.cu...@gtempaccount.com
Thanks! 

Patch Attached.
managers.py.patch
449 bytes   View   Download
Aug 24, 2009
Project Member #4 rwpoul...@gmail.com
Fixed in SVN r50. Thanks!
Status: Fixed
Owner: rwpoulton