Hello! I am developing some web-application. The application is expected to store data which is reported from different location. And the data needs to be accessible to different web administrators (in different location). In this case I want to display reported data to each administrator based on his location.
I have tried to override the queryset(self, request) method in the admin.py file. i.e class ReporterAdmin(admin.ModelAdmin): list_display = ('first_name', 'last_name', 'alias', ) search_fields = ('^first_name', '^last_name', '^alias') form = ReporterAdmin def queryset(self, request): qs = super(ReporterAdmin, self).queryset(request) webuser = WebUser.by_user(request.user) webuser_location = webuser.location child_locations = webuser_location.descendants(include_self = True) return qs.filter(location__in = child_locations) The above code works well (I have also applied the same thing for other models). But when I open the form, foreign key fields still get the whole data instead of filtering based on the web-users location. I can't event have request object as a parameter in forms.py file. Some my question is: 1. Can I program the required feature in Django? i.e. Filter the data based on location in the change list, edit form and also in the filter list (which appears to the right side of change list view of admin page) 2. Is there any other means? Please help me Thank you in advance Andu -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.