Hi, again
Found a solution which doesn't seem to be documented:
If you need a special manager for the admin interface, then you should
add this one to the Admin class of your model:
class Admin:
manager = MyManager()
Regards,
Laurent
On 12 avr, 15:39, "asrenzo" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> We can read in the model reference that we can create an unlimited
> number of managers in a single model. The documentation gives example
> of how to create and use a custom manager. We can also read:
>
> """
> If you use custom Manager objects, take note that the first Manager
> Django encounters (in order by which they're defined in the model) has
> a special status. Django interprets the first Manager defined in a
> class as the "default" Manager.
> """
>
> Unfortunatly, I tried :
>
> class MyManager(models.Manager):
> def get_query_set(self):
> return super(MyManager, self).get_query_set().filter(id=1)
>
> class MyClass(models.Model):
> # Fields
> creation_date = models.DateTimeField(auto_now_add = True)
> modification_date = models.DateTimeField(auto_now = True)
>
> # Managers
> adm = MyManager()
> anon = models.Manager()
>
> And the admin list view of MyClass always displays all records of the
> table.
>
> Any idea ??
>
> Regards,
>
> Laurent
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---