On Feb 10, 7:52 am, Julien Phalip <jpha...@gmail.com> wrote:
> On Feb 10, 7:41 am, Alex Gaynor <alex.gay...@gmail.com> wrote:
>
> > I don't know what manager old forms admin used, but do you have a custom
> > manager that blocks access to some objects.
>
> Thanks Alex for your reply. You've made a really good point which
> helped me track this down. Here are the model and manager:
>
> class PublishedEntryManager(models.Manager):
>         def get_query_set(self):
>                 return super(PublishedEntryManager, 
> self).get_query_set().filter
> (pub_date__lte=datetime.now)
>
> class Entry(models.Model):
>         ... some fields ...
>         pub_date = models.DateTimeField()
>
>         published = PublishedEntryManager()
>
> In fact, if an entry has a pub_date set in the future, then it is not
> accessible in the admin. Somehow the admin seems to be using the
> PublishedEntryManager as default manager. Is there a way to force the
> admin to use the default manager?
>
> Thanks again,
>
> Julien

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 ;)

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