Thank you Picio, that was very useful. I will try it :)
On 1 mar, 09:40, Picio <[EMAIL PROTECTED]> wrote: > You can do It with custom Managers. This was my way to have list > filtered by user, but maybe It's not your case. Depending on the > deisgn of your project, may be It's better > to build a custom view inside the admin (as the djangobook chapter 18 > speaks). > Anyway I do It this way: > > 1 - store the user id taken from a middleware from the superguru > lukeplanthttp://lukeplant.me.uk/blog.php?id=1107301634 > > 2 - create a custom manager for the class you want the change-list page will > be > filtered that override the get_query_set(), this is less or more mine: > > class myCustomizedMan(models.Manager): > def get_query_set(self): > userid=threadlocals.get_current_user().id > return > super(myCustomizedMan,self).get_query_set().filter(your_user__id__exact=userid) > > 3 - I don't know if this problem still occur in 0.95.1 but in 0.95 If > you want to use a custom manager you have to say it inside the admin class: > > class Admin: > ... > bla bla bla filter, list_display whatever you want > ... > manager = myCustomizedMan() > > This was my little hack to have rows filtered by user. This way, people can't > display other users rows, inside the admin change-list page. > > Please consider that every time you achieve to customize the admin, > other new things come up and this hacking way never end. Django 1.0 > will solve this admin > customization issue with the new Admin class. > So IMHO: > 1) try your custom views instead > 2) try to customize the admin via chapter 18 of the djangobook > 3) try my little tric (based on the superduperguruLukeplant great hack) > 4) wait for the new Admin Class (maybe 0.96 will come soon) > > Bye > Picio > > 2007/3/1, zenx <[EMAIL PROTECTED]>: > > > > > Hi, > > > How could I filter the results of my admin change_list page. I know I > > can extend the change_list template but that doesn't allow me to > > filter the results. Is there some easy way to do that? > > > thank you --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---