Sphene Community Tools

Community

Copyright © 2007-2018 by Herbert Poul

You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Board » General » Bug in Post model

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.
thanks for the bug report..
i simply switched the definition of the 'objects' and 'allobjects' model manager and it seems to work

-    objects = PostManager()
     # allobjects also contain hidden posts.
     allobjects = models.Manager()
+    # objects only contains non-hidden posts.
+    objects = PostManager()


i have committed the fix, thanks :)
Hey, we have Signatures !!! Great, isn't it ? ;)

Please login to post a reply.



Powered by Sphene Community Tools