Have a read through this article, Dan:

http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/

On Sep 2, 11:19 am, Dan Klaffenbach <danielklaffenb...@gmail.com>
wrote:
> On 2 Sep., 16:48, Daniel Roseman <dan...@roseman.org.uk> wrote:> It's not 
> clear exactly what you want. Using RequestContext and the
> > request context processor will ensure that the request is present in
> > all your templates. Is that enough?
>
> No. I'll give an example:
>
> I use a custom Acl class for checking the user's permissions (main
> idea: RBAC-like, with role and permission inheritance). Let's say I
> have a form model:
>
> I need the request.user e.g in my application's form models, because I
> need to create an Acl instance in the model in order to check if the
> user can edit fields or not. There are three cases:
> * user can edit form field
> * user can view value (form widget attribute = readonly)
> * user is not allowed to view field at all (do not add element to the
> form at all)
>
> Isn't there any other way to get at least the currently logged in user
> ('REMOTE_USER') in models? Passing the request parameter to models
> doesn't seem like good style to me, it bloats the code and makes it
> harder to read. I do not need the request object in my templates (I
> know this is possible), just in e.g. form models.
>
> Regards,
> Dan

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

Reply via email to