This is what I have now, that is
-my code
-the two answers I got from the creator of our "Admin Hack Code" Luke.

I think we havo do a strict comparison between our and It's code.
My Django version is 0.95 official.
Hope this helps.

Picio

My Code:
http://paste.e-scribe.com/hold/2728/

I Answer
This is implemented using a custom manager.  I implement a Manager that
overrides get_query_set() to add additional filtering:

class UserSpecificMembers(models.Manager):
   def get_query_set(self):
       user = threadlocals.get_current_user()
       if user is None or user.is_anonymous() or not user.is_staff or
       not\
           user.has_perm('cciwmain.change_member'):
           return super(UserSpecificMembers,
           self).get_query_set().filter(hidden=False)
       else:
           return super(UserSpecificMembers, self).get_query_set()

I then have to do this in my 'Member' model:

class Member:
   # ... lots of stuff here

   # Managers
   # Since this comes first, it will become the 'default manager',
   # used by the admin app:
   objects = UserSpecificMembers()
   # This allows me to get all 'Member' objects,
   # required by a few bits of code:
   all_objects = models.Manager()

Apologies if my mail client mangles it a bit.

Regards,

Luke
===================================================
II Answer
I don't know why it isn't working.  I would try putting some debug print
statements in the 'get_query_set' method to see whether it is really
being called.  Also, from a python shell look at
operazione._default_manager (I think) to check it is the right one.

(BTW, 'ipython' is much better than 'python' for this kind of thing, if
it is available for your platform.)
=================================================
2006/11/12, doubtintom <[EMAIL PROTECTED]>:
>
> I have exactly the same question, Picio. If I find an answer before
> this group does, I'll let you know. Please do the same. Thanks.
>
> Tom Miller
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to