Friday, March 27, 2015

Re: Global access to request.user

I agree with Anderson, this is one solution, even
though I don't know if it's a good way.

For example a middleware is used to add the user to
the request. You could do the same with the request
to a singleton instance and get it back then from your
form, view etc.? But be aware that some function should
work within the request cycle or without.

A filter or tag is only a way to process/render data inside
the templates. I don't see it as a solution.

On 03/26/2015 05:19 PM, Esau Rodriguez wrote:
> I don't see how middleware could be used to avoid passing the user or
> request parameter to the inner methods.
>
> As this is part of the view, I'd probably write a custom filter or tag, I dunno.
>
> Regards,
> Esau.
>
> On Thu, Mar 26, 2015 at 2:52 PM, Anderson Resende
> <andersonresende86@gmail.com> wrote:
>> You can use middlewares!!! It is a way...
>>
>>
>> --
>> 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 django-users+unsubscribe@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> 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/2c55f576-7012-49a2-bd53-a8e5fdc4754a%40googlegroups.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>
>

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/55151A6B.2030100%40arkade.info.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment