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 = pollster.forms.LogInFo
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 a
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 in
tains 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,
'
gt; >>
>> >> [1] https://docs.djangoproject.com/en/1.9/releases/1.8/#miscellaneous
>> >>
>> >> On Saturday, February 27, 2016 at 11:21:18 PM UTC+1,
>> >> larry@gmail.com
>> >> wrote:
>> >>>
>> >
ote:
> >>> > 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 i
11:21:18 PM UTC+1, larry@gmail.com
>> wrote:
>>>
>>> On Sat, Feb 27, 2016 at 5:14 PM, knbk wrote:
>>> > The `__repr__` method on HttpRequest was simplified in 1.9[1]. It is not
>>> > an
>>> > accurate description of what is actually co
, 2016 at 5:14 PM, knbk 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 do with the actual issues you're facing.
>
gt; 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) request
>
&
gt;
> [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 blank page with a 200 back.
&
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]
https://docs.djangoproject.com/en/1.9/releases/1.9/#httprequest-details-in-
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, it doesn't
>> work at all because the request stru
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 be most suspicious of midd
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)
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:,
CO
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 loud, we have to
>> over
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 override __init__() t
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 g
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
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.
T
12:22, Nikunj 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.l
/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 modified dynamically such that
when client-1 is using the application, his logs g
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 the logged in user (and thus
> client). These inturn are stored in a mysql database.
>
> How can django log
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 inform
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
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 adding reque
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 unsubscrib
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, s
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 dja
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
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 backend
> that I'
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
und the availability 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 B
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 I g
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 reque
t; 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 should be
no need f
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 troubl
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 request/response cycle, but
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
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 aga
s it is from
> 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
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 approa
, 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 *why* the
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 to override
> __init__ to accomplish this? Seems like the kind of thing Django could "take
> care of" for us.
>
> [1] ht
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 view
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 to all client
>
> but
>
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 that.
> >
> > But i just do maintain a django proje
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 project, and i do not want to
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 the problem.
>
> throu
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 the problem.
>
> throug
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 cur
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 the
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.
> > thanks
> > regards,
> > kejun
>
>
t 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 out
of the context supplied to
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 subscri
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.
> --
> DR.
--
You received
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 t
super(EventBookForm, self).__init__(*args, **kwargs)
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
ile 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 two
> sites)
> then for th
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 is
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'
; > 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 middleware.
&g
e 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.
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 Wednesday, February 2,
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? Wha
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 to
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 ag
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 w
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
27;REMOTE_USER' in request.META:
return HttpResponse(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 pro
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 got using
> RequestFactory
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.
> i think response object re
ippets/963/ )
On Wed, Sep 22, 2010 at 4:24 PM, bruno desthuilliers <
bruno.desthuilli...@gmail.com> wrote:
> On 22 sep, 11:31, girish shabadimath wrote:
> > hi all,
> >
> > i used django snippethttp://djangosnippets.org/snippets/963/
> >
> > and successf
On 22 sep, 11:31, girish shabadimath 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 checked response.content it matches with the b
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
and
On 9 September 2010 05:46, akcom 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_templ
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
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
&
x27;) 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
On Sep 2, 3:30 pm, Daniel Klaffenbach
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 models and I was wondering
&g
On Thu, Sep 2, 2010 at 3:30 PM, Daniel Klaffenbach
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 models and
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
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 s
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 wrote:
> I have found some code that can get the request object.
>
> f = sys._getframe()
> while f:
> request = f.f_locals.get
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 ha
On Sat, Jul 31, 2010 at 12:37 PM, cootetom 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. This doesn
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
wrote:
> Just add django.core.context_processors.request to your
> TEMPLATE_CONTEXT_PROCESSORS, this way you can access the curren
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.request
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 wrote:
> Hi all,
>
> Is there any way of getting the request.path value without having the
&g
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
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 to the
On Wed, Jun 23, 2010 at 3:04 PM, thusjanthan 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 I can't access the
> get_full_pat
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
as a global variable -- how can I do that?
>
Sending messages to an user is very much tied to the current request
-- only the current request can tell you which user is active
currently, so whatever way you choose to store and retrieve
notifications (database, sessions etc) you always need the re
1 - 100 of 208 matches
Mail list logo