Re: Accessing Request Object in Form Definition

2016-02-23 Thread Chris Kavanagh
Thank you so much, James. . .I greatly appreciate you taking the time to answer! On Tuesday, February 23, 2016 at 1:50:57 AM UTC-5, James Schneider wrote: > > On Mon, Feb 22, 2016 at 10:23 PM, Chris Kavanagh > wrote: > >> To possibly answer my own question, thinking out

Re: Accessing Request Object in Form Definition

2016-02-22 Thread James Schneider
On Mon, Feb 22, 2016 at 10:23 PM, Chris Kavanagh wrote: > To possibly answer my own question, thinking out loud, we have to override > the Form Constructor so we can pass in the Request from the view when > instantiating the Form? > You beat me to it. Yes, you would need to

Re: Accessing Request Object in Form Definition

2016-02-22 Thread Chris Kavanagh
To possibly answer my own question, thinking out loud, we have to override the Form Constructor so we can pass in the Request from the view when instantiating the Form? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Accessing Request Object in Form Definition

2016-02-22 Thread Chris Kavanagh
I'm trying to understand how overriding the Constructor of a Form (forms.Form or model.Models) allows you to access the Request Object? How does overriding __init__ allow one access to the Request? I've looked at BaseForm and don't see the Request in the Constructor. So, I don't get it. I

Re: Accessing request object

2014-09-22 Thread Salvatore DI DIO
I understand now, Thank you very much Altus and Collin 2014-09-23 1:30 GMT+02:00 alTus : > Collin said you can attach your `request` object to the form object > somewhere in your view. After that you will be able to use in anywhere in > methods. > Also you can consider

Re: Accessing request object

2014-09-22 Thread alTus
Collin said you can attach your `request` object to the form object somewhere in your view. After that you will be able to use in anywhere in methods. Also you can consider adding request parameter explicitly to your __init__ method and then passing it to `restrictQuery`. PS. restrictQuery

Re: Accessing request object

2014-09-22 Thread Salvatore DI DIO
Excuse me Collin, I don't understang what you are meaning ... Le lundi 22 septembre 2014 17:46:41 UTC+2, Collin Anderson a écrit : > > Can you attach the request to `form.request`? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: Accessing request object

2014-09-22 Thread Collin Anderson
Can you attach the request to `form.request`? -- 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+unsubscr...@googlegroups.com. To post to this group,

Accessing request object

2014-09-21 Thread Salvatore DI DIO
Hello, Is it possible to access request object in 'helpers.py' file ? Ihave tried 'crequest' (from crequest.middleware import CrequestMiddleware) without luck. class AdminField(object): def __init__(self, form, field, is_first): self.field = form[field] # A django.forms.BoundField

Re: Accessing request object in templates

2008-01-04 Thread annacoder
On Jan 4, 7:34 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Thu, 2008-01-03 at 23:10 +0530, venkata subramanian wrote: > > Hi, > > I had a problem recently. > > To access the request object in all of my templates. > > The solution I got surprised me. It involved explicitly passing

Re: Accessing request object in templates

2008-01-04 Thread annacoder
Thanks a lot for your detailed answer. In Zen terms, I am 'enlightened' now ;) On Jan 4, 1:07 am, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > On Jan 3, 2008 2:33 PM, annacoder <[EMAIL PROTECTED]> wrote: > > > > > I understand *how* it is done. > > > But, my question was not related to the how

Re: Accessing request object in templates

2008-01-03 Thread Malcolm Tredinnick
On Thu, 2008-01-03 at 23:10 +0530, venkata subramanian wrote: > Hi, > I had a problem recently. > To access the request object in all of my templates. > The solution I got surprised me. It involved explicitly passing on > the request object from the views. > (Example, to pass a

Re: Accessing request object in templates

2008-01-03 Thread Marty Alchin
On Jan 3, 2008 2:33 PM, annacoder <[EMAIL PROTECTED]> wrote: > > I understand *how* it is done. > > But, my question was not related to the how part. Here's a quick rundown of the "why". Templates aren't triggered by HTTP requests like views are. Instead, they're rendered inside views, which

Re: Accessing request object in templates

2008-01-03 Thread annacoder
I understand *how* it is done. But, my question was not related to the how part. On Jan 4, 12:17 am, Ariel Calzada <[EMAIL PROTECTED]> wrote: > venkata subramanian wrote: > > Hi, > > I had a problem recently. > > To access the request object in all of my templates. > > The solution I got

Re: Accessing request object in templates

2008-01-03 Thread annacoder
Can you explain what is the security issue? On Jan 3, 10:58 pm, Sam Lai <[EMAIL PROTECTED]> wrote: > Security maybe? > > Not sure, but if you add django.core.context_processors.request to > your TEMPLATE_CONTEXT_PROCESSORS list in settings.py, you won't have > to explicitly add the request

Re: Accessing request object in templates

2008-01-03 Thread Ariel Calzada
venkata subramanian wrote: > Hi, > I had a problem recently. > To access the request object in all of my templates. > The solution I got surprised me. It involved explicitly passing on > the request object from the views. > (Example, to pass a RequestContext object as a context_instance >

Re: Accessing request object in templates

2008-01-03 Thread Alex Koshelev
No. RequestContext instance used to handle context processors. It doesn't pass request instance to the context. Request instance passed to template context only by "django.core.context_processors.request" if its installed. On 3 янв, 20:40, "venkata subramanian" <[EMAIL PROTECTED]> wrote: > Hi, >

Re: Accessing request object in templates

2008-01-03 Thread Sam Lai
Security maybe? Not sure, but if you add django.core.context_processors.request to your TEMPLATE_CONTEXT_PROCESSORS list in settings.py, you won't have to explicitly add the request object in every view. You still have to pass a RequestContext object to the render_to_response method, but you

Accessing request object in templates

2008-01-03 Thread venkata subramanian
Hi, I had a problem recently. To access the request object in all of my templates. The solution I got surprised me. It involved explicitly passing on the request object from the views. (Example, to pass a RequestContext object as a context_instance parameter in render_to_response method). It