Django: How to get current user in admin forms

Posted by lazerscience on Stack Overflow See other posts from Stack Overflow or by lazerscience
Published on 2010-05-19T11:17:25Z Indexed on 2010/05/19 11:20 UTC
Read the original article Hit count: 535

In Django's ModelAdmin I need to display forms customized according to the permissions an user has. Is there a way of getting the current user object into the form class, so that i can customize the form in its __init__ method?
I think saving the current request in a thread local would be a possibility but this would be my last resort think I'm thinking it is a bad design approach....

© Stack Overflow or respective owner

Related posts about django

Related posts about django-forms