On Feb 10, 3:19 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> On Mon, Feb 9, 2009 at 4:17 PM, Julien Phalip <jpha...@gmail.com> wrote:
> > Hello again,
>
> > I finally fixed it with the following nasty hack:
>
> > class Entry(models.Model):
> >        ... some fields ...
>
> >         objects = models.Manager() # Nasty hack
> >        published = PublishedEntryManager()
>
> > It seems like the 'change_state' view uses the custom manager instead
> > of the default one. Explicitly setting 'objects' make it work. If you
> > can think of a more elegant fix, please let me know ;)
>
> ? The first manager declared IS the default manager, so if the first and
> only manager you had declared was the restrictive one, that was the default,
> so that is what was used.  Declaring an unrestricted manager first, as you
> have done, is the documented way to have an unrestricted default manager
> plus one or more custom more restrictive managers.

I just checked out the doc again, and I had indeed missed that part on
the order of managers. Thank you Karen for the pointer.

What I found confusing though, is that the "change list" view
displayed *all* entries, including the unpublished ones. So that view
supposedly didn't use the one and only, restrictive, manager that I
had defined. As opposed to the "change object" view which apparently
made use of that restrictive manager. In effect, the unpublished
entries were listed but when you clicked on them you got that 404
page. Had the unpublished entries not showed up at all (including in
the change list) I would have thought of an issue with managers
earlier.

Because it's an old version of Django, and not even a official
release, that might just be a bug which was then fixed at a later
stage.

Regards,

Julien
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to