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 =
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
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
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
>> 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
<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
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
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
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
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
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]
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,
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
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.:
&
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
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
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
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
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
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.
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
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
> /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
,
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
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
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
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
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
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,
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
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
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
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
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
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
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 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
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
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
> 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
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
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
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
; 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
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
;
> 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
> 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
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
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
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
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
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
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
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
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
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.
&
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
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
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
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
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.
> --
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
)
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
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
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
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
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
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
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
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?
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
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
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
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
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
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
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.
>
/ )
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/
> >
>
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
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
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
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
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
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
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
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')
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
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
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
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
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
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.
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
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
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
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
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
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
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
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 - 100 of 203 matches
Mail list logo