Saturday, August 13, 2011

Re: Showing per-user information in admin

Thanks a lot derek! It's just all I was looking for :)

On Fri, Aug 12, 2011 at 4:03 PM, Derek <gamesbook@gmail.com> wrote:
On Aug 12, 1:29 pm, Isaac <vyrp...@gmail.com> wrote:
> Hi dudes,
>
> I'm having trouble at finding a solution for my problem. All I want to
> do is tune django admin to show, for a given user an a given model, only
> instance related to that user.
>
> my pseudocode
>
> class User
>      ...
> class A
>      foreign_key User
>
> A1 related to User1
> A2 related to User1
> A3 related to User2
>
> then, I want that User1 was only be able to see A1 and A2, and User2 was
> only be able to see A3.
> I know that I can create filters to allow user to filter instances, but
> all I want is not to allow user to make that decision, it will be only
> able to see what its related.
>
> Any clue about how to use admin in this way?
>
> Thanks in advance

See:
http://lincolnloop.com/static/slides/2010-djangocon/customizing-the-admin.html#slide45
for an example of this. Note how the default queryset is now filtered
per user.

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate