Keith Eberle wrote:

>Maybe you can do something similar to what's in this post (using queryset):
>http://groups.google.com/group/django-users/browse_thread/thread/c59b3807631d2914/a07cabfb4725447d?lnk=gst&q=restrict+users+to+their+own+data#a07cabfb4725447d

Is that still valid? I can find no documentation for a queryset method
on the ModelAdmin class here:

http://docs.djangoproject.com/en/dev/ref/contrib/admin/

I added one regardless to my ProjectCodeAdmin class:

class ProjectCodeAdmin(admin.ModelAdmin):
    def queryset(self, request):
        return super(ProjectCodeAdmin, self).filter(
            Customer= request.Customer) 

but it seems to be ignored. (I also wonder -- is this supposed to get
called *everywhere* I need a ProjectCode dropdown? Even if there is no
Customer on that page, and hence the request? ...)

That said, placing it there feels wrong. IIUC, a site-specific admin.py
and ModelAdmin instances are ment to tweak the admin interface. Limiting
the list of ProjectCodes in the dropdown can be done there, but
resticting the allowed ProjectCodes should be done in the model. Doesn't
that mean the code now has to be written twice?

My biggest worry, though, is updating the user interface if a new or
different Customer is selected. I have seen no suggestions yet that
admin is able to cope with that without too much intervention on my
part... Hopefully that's because people knowing it can, and how, are
currently busy with more important stuff like going out and having fun.
;)

Regards,
Gertjan.

-- 
Gertjan Klein <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~
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