Maybe you can use get_queryset in the admin class and replace the query
manager

ref:
https://docs.djangoproject.com/en/1.7/ref/contrib/admin/#django.contrib.admin.ModelAdmin.get_queryset

https://docs.djangoproject.com/en/1.7/topics/db/managers/

you can do something like this:

def get_queryset(self, request):
    """
    Returns a QuerySet of all model instances that can be edited by the
    admin site. This is used by changelist_view.
    """
    if request.user.is_superuser:
        qs = self.model.superuser_manager.get_queryset()
    else:
        qs = self.model._default_manager.get_queryset()

    ordering = self.get_ordering(request)
    if ordering:
        qs = qs.order_by(*ordering)
    return qs

2015-03-01 17:06 GMT-06:00 Rootz <[email protected]>:

> Question.
> How would one go about designing the django table(s) so that I can assign
> each user account/group a different Model Manager using the same table in
> the Django admin interface?
>
> After doing some reading the closest that comes to this is the Proxy Model
> but I tried adding the proxy model manually into the django admin and got
> an error while loading it.
>
> My goal is to create one table that returns a custom QuerySet unique to a
> user group or user account. Adding to this I would like for this to be
> visible in the admin interface. Can you guide me as to how can achieve this.
>
> thank you
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/cd13f5ab-633e-4361-a621-cfc11d5d01a5%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/cd13f5ab-633e-4361-a621-cfc11d5d01a5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
"La utopĂ­a sirve para caminar" Fernando Birri

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG%2B5VyNCYpSs0quBUVPSiTgUsApP9tD_F0JwnwLxwiuSpyM8nQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to