Re: Why the next parameter does NOT show up in request object?

2019-11-01 Thread Christian Seberino
Andreas Thanks so much. This was very helpful. For what its worth, the keyword on the Form class seems to be "initial" rather than "initial_data" now. Thanks again! Awesome stuff! cs > def log_in(request): > if request.method == "POST": > form =

Re: Why the next parameter does NOT show up in request object?

2019-11-01 Thread Andréas Kühne
Hi, There are 2 errors in your code. First, when you do a request to the page, it is a get (you go from another page to this page). In this case the next parameter is there and you receive it in the "else" part of your view function (because the request is a get). So you have the next parameter

Why the next parameter does NOT show up in request object?

2019-11-01 Thread Christian Seberino
I can see the next parameter hanging off the URL of my log_in page. However, I cannot *read* it in my view code. The next parameter does NOT get passed to my Python code...Why not? Is my form action = "." the problem below? Here is the traceback. https://dpaste.de/H7KU Here is my log

Using the request object in the forms.py file

2019-04-05 Thread Kayode Oladipo
the aspirant going for that particular position. I intend doing this by gettting the urls and comparing them with the absolute url of each aspirant. But I have trouble doing this, I can't seem to succesfully get the request object to work. I'll appreciate any help. Cheers, 'Kayode My forms.py

Re: empty request object

2016-02-29 Thread Larry Martell
>> On Sat, Feb 27, 2016 at 5:14 PM, knbk <marte...@gmail.com> wrote: >> >>> > The `__repr__` method on HttpRequest was simplified in 1.9[1]. It is >> >>> > not >> >>> > an >> >>> > accurate description of what is

Re: empty request object

2016-02-29 Thread knbk
<marte...@gmail.com> wrote: > >>> > The `__repr__` method on HttpRequest was simplified in 1.9[1]. It is > not > >>> > an > >>> > accurate description of what is actually contained in the request, > and I > >>> > doubt it has anything to d

Re: empty request object

2016-02-29 Thread Larry Martell
e description of what is actually contained in the request, and I >>> > doubt it has anything to do with the actual issues you're facing. >>> > >>> > [1] >>> > >>> > https://docs.djangoproject.com/en/1.9/releases/1.9/#httprequest-details-in-error

Re: empty request object

2016-02-27 Thread Larry Martell
you're facing. >> > >> > [1] >> > >> > https://docs.djangoproject.com/en/1.9/releases/1.9/#httprequest-details-in-error-reporting >> >> I am printing the request object from the debugger: >> >> (Pdb) request >> >> >> This

Re: empty request object

2016-02-27 Thread knbk
nd I > > doubt it has anything to do with the actual issues you're facing. > > > > [1] > > > https://docs.djangoproject.com/en/1.9/releases/1.9/#httprequest-details-in-error-reporting > > > I am printing the request object from the debugger: > > (Pdb) requ

Re: empty request object

2016-02-27 Thread Larry Martell
facing. > > [1] > https://docs.djangoproject.com/en/1.9/releases/1.9/#httprequest-details-in-error-reporting I am printing the request object from the debugger: (Pdb) request This is not in the debug page. I'm pretty sure it's empty as when I call login(request) I get a bl

Re: empty request object

2016-02-27 Thread knbk
The `__repr__` method on HttpRequest was simplified in 1.9[1]. It is not an accurate description of what is actually contained in the request, and I doubt it has anything to do with the actual issues you're facing. [1]

Re: empty request object

2016-02-27 Thread Larry Martell
On Sat, Feb 27, 2016 at 5:02 PM, James Schneider wrote: > > On Feb 27, 2016 1:55 PM, "Larry Martell" wrote: >> >> Anyone have any insights on this? Is there anything special I need to >> do get the request structure? The way this 1.9 site is now,

Re: empty request object

2016-02-27 Thread James Schneider
On Feb 27, 2016 1:55 PM, "Larry Martell" wrote: > > Anyone have any insights on this? Is there anything special I need to > do get the request structure? The way this 1.9 site is now, it doesn't > work at all because the request structure is not getting passed in. > I'd

Re: empty request object

2016-02-27 Thread Larry Martell
e: > I just integrated a broken django setup, 1.9, python 2.7, nginx, > uWSGI, RHEL 6. First thing I observed, the views are not receiving > anything in the request object, e.g.: > > (Pdb) print request > > > Other django systems I've worked with I always get something, e.g.: &

empty request object

2016-02-26 Thread Larry Martell
I just integrated a broken django setup, 1.9, python 2.7, nginx, uWSGI, RHEL 6. First thing I observed, the views are not receiving anything in the request object, e.g.: (Pdb) print request Other django systems I've worked with I always get something, e.g.: (Pdb) print request , POST:, COOKIES

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: Using request object in settings.py for custom logging

2015-11-27 Thread Nikunj Badjatya
Anyone with any idea how to solve this problem? Thanks in advance. -- 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.

Re: Using request object in settings.py for custom logging

2015-11-25 Thread Nikunj Badjatya
kunj Badjatya wrote: >> >> Hello, >> >> Currently for our application, all django logs are generated and kept at >> '/var/log/django.log' >> We want to have different log files for different clients. i.e. >> /var/log/client-1/django.log >> /var

Re: Using request object in settings.py for custom logging

2015-11-25 Thread Jani Tiainen
The request object has information about the logged in user (and thus client). These inturn are stored in a mysql database. How can django log file path be modified dynamically such that when client-1 is using the application, his logs go into '/var/log

Re: Using request object in settings.py for custom logging

2015-11-25 Thread Nikunj Badjatya
> /var/log/client-1/django.log > /var/log/client-2/django.log > /var/log/client-3/django.log > > > > The request object has information about the logged in user (and thus > client). These inturn are stored in a mysql database. > > How can django log file path be m

Re: Using request object in settings.py for custom logging

2015-11-24 Thread Jani Tiainen
, Currently for our application, all django logs are generated and kept at '/var/log/django.log' We want to have different log files for different clients. i.e. /var/log/client-1/django.log /var/log/client-2/django.log /var/log/client-3/django.log The request object has information about

Using request object in settings.py for custom logging

2015-11-24 Thread Nikunj Badjatya
Hello, Currently for our application, all django logs are generated and kept at '/var/log/django.log' We want to have different log files for different clients. i.e. /var/log/client-1/django.log /var/log/client-2/django.log /var/log/client-3/django.log The request object has

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 <mortas...@gmail.com>: > 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. > Als

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

Access request object in a custom template tag

2013-04-29 Thread Ponytech
Hello, I am currently writing a custom template tag and I need to access the request object within the tag code. When using tag helpers (*simple_tag*, *inclusion_tag *and *assignment_tag*) you can register them with an additional takes_context=True parameter that makes the request object

Re: how should I get the request object?

2012-11-27 Thread Russell Keith-Magee
On Tue, Nov 27, 2012 at 12:38 PM, Wade Williams <wwilli...@local-motors.com>wrote: > I share the disdain for global variables as well. > > I'm fairly new to Django, and what I'm not understanding is when the > request object is available for inclusion. I have a custom session b

Re: how should I get the request object?

2012-11-27 Thread Wade Williams
I share the disdain for global variables as well. I'm fairly new to Django, and what I'm not understanding is when the request object is available for inclusion. I have a custom session backend that I've built in order to support a legacy user model and session table -- when I tried to simply

Re: how should I get the request object?

2012-11-26 Thread Russell Keith-Magee
around that global. All the usual problems that are associated with global variables will apply to what you have done here. You say you've done this because it is "inconvenient" to make a request object available deep within the call stack? Frankly, I call BS. Making sure the reques

Re: how should I get the request object?

2012-11-26 Thread Mike S
Sometimes it is very inconvenient to make the `request` object available deep in the call stack, so I wrote a short middleware to work around this issue: http://djangosnippets.org/snippets/2853/ On Monday, November 26, 2012 5:16:01 AM UTC-5, Miaobing Jiang wrote: > > how should

Re: how should I get the request object?

2012-11-26 Thread Daniel Roseman
On Monday, 26 November 2012 10:16:01 UTC, Miaobing Jiang wrote: > how should I get the request object when I need that object in some places > rather than in the view for each view has request as its first parameter? > Pass it from the view into whatever functions need it. -- DR.

how should I get the request object?

2012-11-26 Thread Miaobing Jiang
how should I get the request object when I need that object in some places rather than in the view for each view has request as its first parameter? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the

request object in custom TEMPLATE_LOADER

2012-10-16 Thread mmuk2
Hi, I'm sure this question has been asked before, but I thought I'd throw it out there as it's something I've come across in a project I'm working on at present. What is the best way to include a request object in a custom template_loader? The reason I need the request object available in my

Re: Why can't forms access the request object?

2012-03-12 Thread Tom Evans
ill > thinking about the best way to handle this particular issue, for instance). > > Matt. > If your form requires access to the request object, or to the currently logged in user, it should simply take that object as an additional required argument to the form constructor. There shoul

Re: Why can't forms access the request object?

2012-03-12 Thread Matt Schinckel
> Thanks for the explanations Masklinn and dstuffte - this makes a lot more > > sense now. I guess I was thinking of this in more simplistic terms - I > was > > assuming that a form is always invoked from a view, so naturally it would > > inherit the request object. I'm havin

Re: Why can't forms access the request object?

2012-03-12 Thread Sergiy Khohlov
kes a lot more > sense now. I guess I was thinking of this in more simplistic terms - I was > assuming that a form is always invoked from a view, so naturally it would > inherit the request object. I'm having trouble thinking of  a use case where > a  form would  not be part of any r

Re: Why can't forms access the request object?

2012-03-12 Thread shacker
Thanks for the explanations Masklinn and dstuffte - this makes a lot more sense now. I guess I was thinking of this in more simplistic terms - I was assuming that a form is always invoked from a view, so naturally it would inherit the request object. I'm having trouble thinking of a use case

Re: Why can't forms access the request object?

2012-03-11 Thread Donald Stufft
On Sunday, March 11, 2012 at 12:43 PM, shacker wrote: > On Sunday, March 11, 2012 6:24:30 AM UTC-7, skhohlov wrote: > > Of course form does not have access to the object. > > > skholov - Thanks, but you misunderstand my question. Again, I know that forms > don't have access to request, and

Re: Why can't forms access the request object?

2012-03-11 Thread Masklinn
; views. 1. Because there are no paths to do it automatically, this would require passing the request object to all forms explicitly 2. Because, as Donald noted, forms don't *need* a request object and indeed can be used completely independently from the request/response cycle (or from a given request

Re: Why can't forms access the request object?

2012-03-11 Thread shacker
On Sunday, March 11, 2012 6:24:30 AM UTC-7, skhohlov wrote: > > Of course form does not have access to the object. skholov - Thanks, but you misunderstand my question. Again, I know that forms don't have access to request, and again, I've got it working already (though with a different

Re: Why can't forms access the request object?

2012-03-11 Thread Sergiy Khohlov
; > On Sunday, March 11, 2012 at 4:32 AM, shacker wrote: > > I recently needed to access request.user in a form, and found that I > couldn't. Found many articles describing ways to accomplish this, such as > James Bennett's [1]. > > I did get it working, but I'm curious *w

Re: Why can't forms access the request object?

2012-03-11 Thread Donald Stufft
> I did get it working, but I'm curious *why* the request object isn't > accessible from forms as it is from views. Why do we need to override > __init__ to accomplish this? Seems like the kind of thing Django could "take > care of" for us. > > [1] http://www.b-list.org/weblo

Why can't forms access the request object?

2012-03-11 Thread shacker
I recently needed to access request.user in a form, and found that I couldn't. Found many articles describing ways to accomplish this, such as James Bennett's [1]. I did get it working, but I'm curious *why* the request object isn't accessible from forms as it is from views. Why do we need

Re: how to get request object out of views

2011-08-09 Thread bruno desthuilliers
On Aug 9, 12:13 pm, Kejun He wrote: > On Tue, Aug 9, 2011 at 5:54 PM, bruno desthuilliers < > > > > DONT import settings that way. ALWAYS use "from django.conf import > > settings" > > I test in my development server, and found that > > from django.conf import settings   is

Re: how to get request object out of views

2011-08-09 Thread Kejun He
hi, I will do as your method thanks for your reply regards, kejun On Tue, Aug 9, 2011 at 5:56 PM, Tom Evans wrote: > On Tue, Aug 9, 2011 at 10:22 AM, Kejun He wrote: > > hi, > > Ok, It is a good method to get the current user. I am sorry for

Re: how to get request object out of views

2011-08-09 Thread Kejun He
On Tue, Aug 9, 2011 at 5:54 PM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > On Aug 9, 11:22 am, Kejun He wrote: > > hi, > > Ok, It is a good method to get the current user. > > It's actually THE good method. > > > > > But i just do maintain a django

Re: how to get request object out of views

2011-08-09 Thread Tom Evans
On Tue, Aug 9, 2011 at 10:22 AM, Kejun He wrote: > hi, > Ok, It is a good method to get the current user. I am sorry for that. > > But i just do maintain a django project, and i do not want to change the > template structure. > > And now, I have found a new method to resolve

Re: how to get request object out of views

2011-08-09 Thread bruno desthuilliers
On Aug 9, 11:22 am, Kejun He wrote: > hi, > Ok, It is a good method to get the current user. It's actually THE good method. > > But i just do maintain a django project, and i do not want to change the > template structure. > > And now, I have found a new method to resolve

Re: how to get request object out of views

2011-08-09 Thread Kejun He
hi, Ok, It is a good method to get the current user. I am sorry for that. But i just do maintain a django project, and i do not want to change the template structure. And now, I have found a new method to resolve the problem. through a variable CURRENT_USER defined in settings.py to save the

Re: how to get request object out of views

2011-08-09 Thread Daniel Roseman
On Tuesday, 9 August 2011 02:33:47 UTC+1, oops wrote: > > Hi, > > May be you miss understanted my meaning. > > I just want to get the current user object in a normal .py file out of > views. > > And this file just offer some data according to different user. > > Do you have any methods to get

Re: how to get request object out of views

2011-08-08 Thread Kejun He
f > > the menutree is a list. > > The list comes from another .py file.In this file,I want to get a > current > > user object(LIKE:request.user), > > so I need to get a request object outside the views. > > or other method to get the current user object is fine. &

Re: how to get request object out of views

2011-08-08 Thread Tom Evans
file.In this file,I want to get a current > user object(LIKE:request.user), >  so I need to get a request object outside the views. > or other method to get the current user object is fine. > thanks > regards, > kejun Put the current user into the template context, and pull the user ou

Re: how to get request object out of views

2011-08-08 Thread Kejun He
hi, My goal is to generate some data, For example: I defined a template tag, and it is used to generate a menutree, the item of the menutree is a list. The list comes from another .py file.In this file,I want to get a current user object(LIKE:request.user), so I need to get a request object

Re: how to get request object out of views

2011-08-08 Thread Daniel Roseman
On Monday, 8 August 2011 11:08:29 UTC+1, oops wrote: > > Hi, > > I try to get a request object out of views.py, and could not get the > reqeust object through "def demo(request)". > > Could you tell me how to get it?? > > Or is there other ways to ge

how to get request object out of views

2011-08-08 Thread Kejun He
Hi, I try to get a request object out of views.py, and could not get the reqeust object through "def demo(request)". Could you tell me how to get it?? Or is there other ways to get the same goal. Thanks very much regards, kejun -- You received this message because you are

Re: using the request object inside a form

2011-08-02 Thread vanderkerkoff
Thanks Daniel I told you I was doing something stupid :-) V On Aug 2, 5:22 pm, Daniel Roseman wrote: > The problem isn't in the code you've posted, but in how you instantiate the > form in your view. You need to actually pass in 'request' as a keyword > argument. > --

using the request object inside a form

2011-08-02 Thread Daniel Roseman
The problem isn't in the code you've posted, but in how you instantiate the form in your view. You need to actually pass in 'request' as a keyword argument. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on

using the request object inside a form

2011-08-02 Thread vanderkerkoff
) workshop_choices = [] data = Workshop.objects.filter("some rules based on what I get back from the request object, which is currently none") for d in data: workshop_choices.append((d.title,d.title)) self.fields['workshops']=MultipleC

Re: Pass 'request' object to Form

2011-02-10 Thread Tom Evans
ated today only, because while retrieving all objects in > a > particular many_to_many(TAG) field it is quite slow to process >             As well as in my application flow i need a request object to do > this, > from that request i have to filter the site(HTTP_HOST),(ofcourse using

Pass 'request' object to Form

2011-02-09 Thread NavaTux
slow to process As well as in my application flow i need a request object to do this, from that request i have to filter the site(HTTP_HOST),(ofcourse using two sites) then for that site only the particular tags has be loaded Here my doubt

Re: Get request object in class based generic view and form

2011-02-05 Thread roman
Hello Simon, > But I can't figure out how I can retrieve the request object in the class > based generic view. As far as I understand just get it from self.request. > I want to re-verify the user once again to > make sure his authenticated. > I always do it the way it's recommen

Re: Using custom / Extending default Request Object

2011-02-02 Thread Tereska
on, video codecs > > etc) . > > It's a data collection not simple string. Then I want use it in views > > and templates. > > So, simply attach your information as an attribute of the standard request > object. No need to replace it. You probably want to do this in a mi

Re: Using custom / Extending default Request Object

2011-02-02 Thread Daniel Roseman
use it in views > and templates. > So, simply attach your information as an attribute of the standard request object. No need to replace it. You probably want to do this in a middleware. class DeviceInfoMiddleware(object): def process_request(self, request): request.devic

Re: Using custom / Extending default Request Object

2011-02-02 Thread Tereska
My RequestObject must contain information about user device (mobile, tablets etc) with device capatibilites (resolution, video codecs etc) . It's a data collection not simple string. Then I want use it in views and templates. On Feb 2, 9:27 pm, Daniel Roseman wrote: > On

Re: Using custom / Extending default Request Object

2011-02-02 Thread Daniel Roseman
On Wednesday, February 2, 2011 8:12:30 PM UTC, Tereska wrote: > > I have to extend HttpRequest class and be able to use it in views > (request argument in each view must be instance of MyHttpRequest > class) > > How to do that? (without extending BaseHandler) > > Why do you need to do this?

Using custom / Extending default Request Object

2011-02-02 Thread Tereska
I have to extend HttpRequest class and be able to use it in views (request argument in each view must be instance of MyHttpRequest class) How to do that? (without extending BaseHandler) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

Get request object in class based generic view and form

2011-01-13 Thread Simon W
Hi, I'm trying to put up a modelform for users to edit their 'projects'. But I can't figure out how I can retrieve the request object in the class based generic view. I need it to verify the user. Also, when the form is submitted, I want to re-verify the user once again to make sure his

Re: Request Object Data

2010-12-17 Thread Jonas H.
On 12/17/2010 10:18 PM, hank23 wrote: Is data entered on an input screen automatically added to the request when the screen is submitted? If so are there any special parameters or settings in the screen controls which have to be set/coded to get the entered data saved into the request and under

Request Object Data

2010-12-17 Thread hank23
Is data entered on an input screen automatically added to the request when the screen is submitted? If so are there any special parameters or settings in the screen controls which have to be set/coded to get the entered data saved into the request and under what keys is the data saved? Once in the

Need access to http basic authentication from request object inside view

2010-09-26 Thread mortenlp
tpResponse(request.META['REMOTE_USER']) else: return HttpResponse(request) #Output is appended below All of these keys do not exist... and the complete request object does not contain the string either. Many experience this problem using apache+mod_wsgi because "WSGIPassAuthorization on

Re: Request object problem

2010-09-22 Thread girish shabadimath
ya correct, now i got complete picture of client.get() and RequestFactory, On Wed, Sep 22, 2010 at 5:28 PM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > On 22 sep, 13:17, girish shabadimath wrote: > > Thanks for the reply, actually the response object

Re: Request object problem

2010-09-22 Thread bruno desthuilliers
On 22 sep, 13:17, girish shabadimath wrote: > Thanks for the reply, actually the response object got using RequestFactory > is different from the one returned by client.get() function,, The reponse object you get using RequestFactory is the one returned by your view. >

Re: Request object problem

2010-09-22 Thread girish shabadimath
/ ) On Wed, Sep 22, 2010 at 4:24 PM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > On 22 sep, 11:31, girish shabadimath <girishmss.1...@gmail.com> wrote: > > hi all, > > > > i used django snippethttp://djangosnippets.org/snippets/963/ > > >

Re: Request object problem

2010-09-22 Thread bruno desthuilliers
On 22 sep, 11:31, girish shabadimath <girishmss.1...@gmail.com> wrote: > hi all, > > i used django snippethttp://djangosnippets.org/snippets/963/ > > and successfully created request object > > i checked the response.status_code its giving 200 > > i ch

Request object problem

2010-09-22 Thread girish shabadimath
hi all, i used django snippet http://djangosnippets.org/snippets/963/ and successfully created request object i checked the response.status_code its giving 200 i checked response.content it matches with the browser source code when i issue *response.template* it gives error

Re: request object in generic view?

2010-09-09 Thread Łukasz Rekucki
On 9 September 2010 05:46, akcom <cppco...@gmail.com> wrote: > Is there anyway to access the request object from a generic view? > Specifically, I'd like to access the request.user object.  I tried > doing it as follows: > (r'^$', 'django.views.generic.simple.direct_to_tem

request object in generic view?

2010-09-08 Thread akcom
Is there anyway to access the request object from a generic view? Specifically, I'd like to access the request.user object. I tried doing it as follows: (r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'index.html', 'extra_context' : {'request' : request}} hoping

Re: Alternative to passing request object to every object/function?

2010-09-02 Thread Scott Gould
rameter 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

Re: Alternative to passing request object to every object/function?

2010-09-02 Thread Dan Klaffenbach
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 subscribe

Re: Alternative to passing request object to every object/function?

2010-09-02 Thread Daniel Roseman
On Sep 2, 3:30 pm, Daniel Klaffenbach <danielklaffenb...@gmail.com> wrote: > Hi, > > I am developing a Django app which relies on information from the > request object a lot, especially request.user. I need this object (or > let's say at least 'REMOTE_USER') in many model

Re: Alternative to passing request object to every object/function?

2010-09-02 Thread Tom Evans
On Thu, Sep 2, 2010 at 3:30 PM, Daniel Klaffenbach <danielklaffenb...@gmail.com> wrote: > Hi, > > I am developing a Django app which relies on information from the > request object a lot, especially request.user. I need this object (or > let's say at least 'REMOTE_USER')

Alternative to passing request object to every object/function?

2010-09-02 Thread Daniel Klaffenbach
Hi, I am developing a Django app which relies on information from the request object a lot, especially request.user. I need this object (or let's say at least 'REMOTE_USER') in many models and I was wondering if there is another way to get the request object? In PHP there is something like

Re: Get request path without having a request object

2010-08-27 Thread David De La Harpe Golden
On 27/08/10 14:22, Sells, Fred wrote: > I'm not sure of the thread safety of Django and wonder if I could store > this object as a local variable of some module like No, that is not likely to work except in a single-threaded* context, and even then it's a bit fraught (just being single-threaded

Get request path without having a request object

2010-08-27 Thread Sells, Fred
I've looked at http://www.djangobook.com/en/beta/chapter12/ and the section on Using sessions outside of views which shows: >>> from django.contrib.sessions.models import Session >>> s = Session.objects.get_object(pk='2b1189a188b44ad18c35e113ac6ceead') But where does that pk come from? I'm down

Re: Get request path without having a request object

2010-08-03 Thread cootetom
I have finished and made this app available via it's own web site. Take a look http://poedit.tomcoote.co.uk/ On Aug 1, 1:18 pm, cootetom <coote...@gmail.com> wrote: > I have found some code that can get the request object. > > f = sys._getframe() > while f: >     req

Re: Get request path without having a request object

2010-08-01 Thread cootetom
I have found some code that can get the request object. f = sys._getframe() while f: request = f.f_locals.get('request') if isinstance(request, HttpRequest): path = request.path break f = f.f_back James: I understand completely what you are saying and have thought

Re: Get request path without having a request object

2010-07-31 Thread James Bennett
On Sat, Jul 31, 2010 at 12:37 PM, cootetom <coote...@gmail.com> wrote: > Thanks Carlos but I'm trying to achieve getting the path without > having to pass the request object. In a word: don't. Instead, design your system to pass the information you need where and when you need it.

Re: Get request path without having a request object

2010-07-31 Thread cootetom
Thanks Carlos but I'm trying to achieve getting the path without having to pass the request object. On Jul 31, 7:11 pm, Carlos Daniel Ruvalcaba Valenzuela <clsdan...@gmail.com> wrote: > Just add django.core.context_processors.request to your > TEMPLATE_CONTEXT_PROCESSORS, this way yo

Re: Get request path without having a request object

2010-07-31 Thread Carlos Daniel Ruvalcaba Valenzuela
Just add django.core.context_processors.request to your TEMPLATE_CONTEXT_PROCESSORS, this way you can access the current request object in your template, you will have to use however RequestContext class with render_to_response, >From docs: django.core.context_processors.requ

Re: Get request path without having a request object

2010-07-31 Thread cootetom
I think perhaps I'll also put this problem another way. I need to cache data against the current web request without having the Django built request object. On Jul 31, 4:56 pm, cootetom <coote...@gmail.com> wrote: > Hi all, > > Is there any way of getting the request.path value

Get request path without having a request object

2010-07-31 Thread cootetom
Hi all, Is there any way of getting the request.path value without having the request object that Django pass's around. Is there something similar to os.environ for the web request where I can get the path? I'm developing an app that needs to cache data on a page basis but the data may come from

Deleting sessions without Request object

2010-07-09 Thread Greg Pelly
Is it possible to log out a user manually? The desired result is that after I do this, the user will be forced to log in again. I will not have an active Request object (ie, this will be done from the admin app or a management command, not a view). Can I simply add the Session table

Re: from a template how to access the request object

2010-06-23 Thread Karen Tracey
On Wed, Jun 23, 2010 at 3:04 PM, thusjanthan <thusjant...@gmail.com> wrote: > From a template suppose base.html in your templates how do I access > the request object without actually passing it via the view. Cause I > can access the user object using {{ user }} but

from a template how to access the request object

2010-06-23 Thread thusjanthan
Hi all. >From a template suppose base.html in your templates how do I access the request object without actually passing it via the view. Cause I can access the user object using {{ user }} but I can't access the get_full_path using something like {{ request.get_full_path }} Any thoug

Re: Closures, Django Request Object, Django architecture

2009-08-25 Thread Matthias Kestenholz
etc) you always need the request object in one way or the other. Really, there is a reason why Django does not provide global (or thread local) request / user objects. If you still want do do it, google for "threadlocals user", but I'd advise against doing that. In the end, it's your d

  1   2   3   >