| Name | narma |
|---|---|
| Email Address | Reveal this emailaddress |
| Posts | 7 |
-
- 2008-06-02 08:00:53
- Re: Bug: Issue with two threads with the same title
- Board >> General
- Unfortunately, I'm not able to reproduce this issue.
I didn't move these Threads, but both ThreadInformation has same type.
-
- 2008-06-02 06:05:00
- Re: Bug: Issue with two threads with the same title
- Board >> General
Traceback: File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in get_response 82. response = callback(request, *callback_args, **callback_kwargs) File "/home/narma/www/sphene/sphboard/views.py" in showThread 130. thread.viewed( request.session, request.user ) File "/home/narma/www/sphene/sphboard/models.py" in viewed 757. threadinfo = self.get_threadinformation() File "/home/narma/www/sphene/sphboard/models.py" in get_threadinformation 618. return ThreadInformation.objects.type_default().get( root_post = self.get_thread() ) File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in get 198. raise self.model.MultipleObjectsReturned("get() returned more than one %s -- it returned %s! Lookup parameters were %s" Exception Type: MultipleObjectsReturned at /forum/thread/84/ Exception Value: get() returned more than one ThreadInformation -- it returned 2! Lookup parameters were {'root_post': <Post: dsfgdfg>}It seems to me that the possible reason is there:In 8: Post.objects.filter(subject='dsfgdfg').count() Out8: 1L In 9: ThreadInformation.objects.filter(root_post=p).count() Out9: 2L
root_post should be unique for each thread. Am I right?
--- Last Edited by narma at 2008-06-02 06:06:14 ---
-
- 2008-05-30 09:51:21
- Bug: Issue with two threads with the same title
- Board >> General
- return:
MultipleObjectsReturned at /forum/thread/84/
get() returned more than one ThreadInformation -- it returned 2! Lookup parameters were {'root_post': <Post: dsfgdfg>}
-
- 2008-05-12 11:51:55
- Bug in Post model
- Board >> General
- When I tried to create a post with attachment an error "Duplicate error" occured.
This reason was the new django ( svn trunk 7520). It uses _default_manager in Class instead of custom sql queries when looking for existing record in order to decide if we should use 'INDEX' or 'UPDATE'.
In model 'Post' default object manager was overriden as 'PostManager' who actually filters query_set.
The solution is to define models.Manager() before 'PostManager', so it will be default for Post as Django uses the first-defined Manager as default.
see http://www.djangoproject.com/documentation/model-api/#managers for details.
