it is doing.CheersMike--(Unsigned mail
from my phone)
Original message From: Alex007 MULUMBA
Date: 3/1/24 08:38 (GMT+10:00) To:
django-users@googlegroups.com Subject: Re: HttpResponse works but
HttpResponseRedirect does not import pandas as pd
from django.http import HttpResponse # Ass
orm data on display. However, I
> want the form cleared ready for the next set of user data.
>
> The following code clears the entered data but fails to download the
> constructed file.
>
> csv = make_csv(context['result'])
>
> # This fails to download a csv fi
> want the form cleared ready for the next set of user data.
>
> The following code clears the entered data but fails to download the
> constructed file.
>
> csv = make_csv(context['result'])
>
> # This fails to download a csv file
>
> return HttpRe
However,
I want the form cleared ready for the next set of user data.
The following code clears the entered data but fails to download the
constructed file.
csv = make_csv(context['result'])
# This fails to download a csv file
return HttpResponseRedirect(
&
Hi!!! usually HttpResponseRedirects work with reverse
function...something like this
def myview(request):
return HttpResponseRedirect(reverse('arch-summary', args=[1945]))
where 'arch-summary' is the path name and args=[1945] the args it expects...
You need to modify also
HttpResponseRedirect to redirect to the progress.
--
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 view this
Cool!
Keep learning - I think that django is probably one of the best COMPLETE
frameworks there is - And now shortly with async support, it will be even
better :)
The way you can quickly prototype something that later on can continue into
production is one of Pythons and Djangos strengths.
Regar
Thank you for the feedback and advices. I will sure check out Django girls.
The mix of parameters was no problem, I figured that out. I was not sure
though how to write the path. But now, at least I know how to send
arguments and that's bothered me for a while. Now I am on the right track
again. :-
:
> This is what I had to do. Thanks to you I know how to think and fixed it.
>
>
> xx="EXTRA ARGUMENT"
> return HttpResponseRedirect(reverse('bsapp:result', args=(question.id, xx,)))
>
>
> path('//result/', views.result, name='result'),
This is what I had to do. Thanks to you I know how to think and fixed it.
xx="EXTRA ARGUMENT"
return HttpResponseRedirect(reverse('bsapp:result', args=(question.id, xx,)))
path('//result/', views.result, name='result'),
def result(request, que
Hi Again
I finally got it to work now.
return HttpResponseRedirect(reverse('bsapp:result', args=(question.id, xx,)))
path('//result/', views.result,
name='result'), (I think you mixed up the order of int:question
here, you wrote question:int)
xx="
n thing in webb application is this hard to understand than I
must find something else. Passing arguments is the most common thng so I
can't understand why Django doesn't offer any example. Anyway what I want
to do is this.
I have this call:
return HttpResponseRedirect(reverse(
n understand or that works. But I am very new on Django so
> maybe I could have missed it. But there must be an easy answer to my
> question. I am following the tutorial for Django and at section 4 they use
> the httpresponseredirect to go to next page after posting a form.
>
>
&
the httpresponseredirect to go to next page after posting a form.
return HttpResponseRedirect(reverse('polls:results', args=(question.id,)))
The views page function looks like this:
def detail(request, question_id):
My question is: How can I send more arguments than the question
t; form = DateForm(request.POST)
>> if form.is_valid():
>> date = form.cleaned_data['date']
>> print(type(date))
>> return HttpResponseRedirect('schedule/{date}')
>>
>> else:
>>
date = form.cleaned_data['date']
> print(type(date))
> return HttpResponseRedirect('schedule/{date}')
>
> else:
> form = DateForm()
>
> return render(request, 'app/date.html', {'form': form})
&
Here's the Django view:
def get_date(request):
if request.method == 'POST':
form = DateForm(request.POST)
if form.is_valid():
date = form.cleaned_data['date']
print(type(date))
return HttpResponseRedirect(
ackends to work with Django
>> 1.4 or newer.
>>
>> Basically:
>>
>> 1. authenticate() works. request.user.is_authenticated() is True
>> 2. Django's own login() seems to work, as request.user is set,
>> request.session is set etc.
>> 3. After the HttpR
Try return HttpResponseRedirect("/login/") instead of return
HttpResponseRedirect("login")
On Monday, December 24, 2018 at 7:35:13 PM UTC+5:30, ali reza wrote:
>
> Greetings!
>
>
> Question:
> I wrote a view (def register(request)) to check if DB is empty,
Greetings!
Question:
I wrote a view (def register(request)) to check if DB is empty, user can to
create a new SuperUser. When DB is empty, “register” view works fine on GET
request. but when user is submitting her/his info (via POST request), then
he/she must be redirected to “login” url (me
dicionobra.html' but I also want to redirect to the page
> "/edicionobra/". In the code below I send the values and I go to
> edicionobra.html, however, the URL is /nuevacuenca/ and that's wrong.
>
> I've tried to put HttpResponseRedirect("/edicionobra/")
27;s wrong.
I've tried to put HttpResponseRedirect("/edicionobra/") at the end of the
form, but then I don't send the values
How can I solve my problem?
def NuevaCuenca(request):
if not request.user.is_authenticated():
return HttpResponseRedirec
Hi coverage has highlighted that I have no unit test for the line,
regarding *HttpResponseRedirect('/accounts/loggedin')*.
How can I write a test that makes Coverage happy regarding this?
views.py
def auth_view(request):
username = request.POST.get('username'
.
>
> Basically:
>
> 1. authenticate() works. request.user.is_authenticated() is True
> 2. Django's own login() seems to work, as request.user is set,
> request.session is set etc.
> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>
> This has happe
is-the-difference-b-w-httpresponse-vs-httpresponseredirect-vs-rende
> -- the accepted answer it is stated that after a successful
> post that HttpResponseRedirect should be used. I understand that it may
> be "cleaner" to do this, but I was wondering how best to pass variab
Hello, I know there are a bunch of threads on this topic (on stacked
overflow at least), but I am having trouble understanding something.
In this post:
http://stackoverflow.com/questions/1921523/django-what-is-the-difference-b-w-httpresponse-vs-httpresponseredirect-vs-rende
-- the accepted
The fix that worked for 1.4.x did not work for 1.5.x.
Only thing that worked for 1.5.x was changing how apache called django, by
setting WSGIDaemonProcess to "processes=1" or removing "processes" entirely
("threads" can be lots more than one). Something has obviously changed in
how django does wsg
Hi,
Can you please exlpain it further. I am facing the same issue. I have
written a get_user() method in my customauthentication.py. My
authentication is successful but the subsequent requests show up as
anonymous user.
Thanks
Praveen.M
On Monday, 21 October 2013 16:28:12 UTC+5:30, HM wro
Turns out: the auth backend that worked in 1.3 but not in 1.4+ was missing
a get_user()-method. I added it in and that was that.
HM
--
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 i
On 14 October 2013 17:06, Tom Evans wrote:
> On Mon, Oct 14, 2013 at 1:52 PM, Hanne Moa wrote:
> > I can't get logging in with alternate auth backends to work with Django
> 1.4
> > or newer.
>
> Are you sure sessions are working correctly? Are you setting cookies
> (for session or otherwise) w
to work, as request.user is set,
> request.session is set etc.
> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>
> This has happened twice now, with different alternate auth backends. I can't
> get rid of Django 1.3 before this is fixed...
>
> In one project I
gt; str = reverse('cm_base.views.index')
>> return HttpResponseRedirect(str)
>> else:
>> # Their password / email combination must have been incorrect
>> pass
>>
>> you are verifying fields only. No more. And in
ogin(request, form.get_user())
> str = reverse('cm_base.views.index')
> return HttpResponseRedirect(str)
> else:
> # Their password / email combination must have been incorrect
> pass
>
> you are verifying fields only. No more. And invali
k with Django
> 1.4
> > or newer.
> >
> > Basically:
> >
> > 1. authenticate() works. request.user.is_authenticated() is True
> > 2. Django's own login() seems to work, as request.user is set,
> > request.session is set etc.
> > 3. After the
Take a look at :
if form.is_valid():
#django.contrib.auth.login
Login(request, form.get_user())
str = reverse('cm_base.views.index')
return HttpResponseRedirect(str)
else:
# Their password / email combination must have been incorrect
s own login() seems to work, as request.user is set,
> request.session is set etc.
> 3. After the HttpResponseRedirect, request.user is AnonymousUser
>
> This has happened twice now, with different alternate auth backends. I can't
> get rid of Django 1.3 before this is fixed...
&
I can't get logging in with alternate auth backends to work with Django 1.4
or newer.
Basically:
1. authenticate() works. request.user.is_authenticated() is True
2. Django's own login() seems to work, as request.user is set,
request.session is set etc.
3. After the HttpRespon
I have an endpoint for renaming an object. After the update occurs, the
view function returns an HttpResponseRedirect to redirect the client to the
restful endpoint now representing that object (since it has been renamed).
The update is a PUT. I expect the 302 redirect to cause my browser to
On Mon, Apr 29, 2013 at 3:43 PM, Shawn Milochik wrote:
> Use HttpResponseRedirect, as you mention in your subject line.
>
Question is 'why'?
-V
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscrib
Use HttpResponseRedirect, as you mention in your subject line.
--
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...@googlegrou
Following this up... any thoughts?
On Thu, Apr 4, 2013 at 9:34 AM, Venkatraman S wrote:
>
> I use django-filetransfers in my app and had a quick Q on one of the
> comments by the author in this post :
> http://www.allbuttonspressed.com/projects/django-filetransfers
>
> He mentions "Note that i
I use django-filetransfers in my app and had a quick Q on one of the
comments by the author in this post :
http://www.allbuttonspressed.com/projects/django-filetransfers
He mentions "Note that it's important that you send a redirect after an
upload. Otherwise, some file hosting services won't work
Actually, just seen that flash hasn't been maintained, and my own personal
usage of it was touch and go at best
These days, I also tend to use the approach of storing a message in the
session instead (as explained by Jirka).
Cal
On Wed, Sep 12, 2012 at 2:35 PM, Jirka Vejrazka wrote:
> If you ha
thank's, that's just what I was looking for.
On Wed, Sep 12, 2012 at 6:35 AM, Jirka Vejrazka wrote:
> If you have sessions enabled, you can use the built-in messages
> framework (look in contrib) to display a message on the "next" page.
> Alternatively, you can save (semi-) arbitrary data in the
If you have sessions enabled, you can use the built-in messages
framework (look in contrib) to display a message on the "next" page.
Alternatively, you can save (semi-) arbitrary data in the user session
and retrieve it in the view that displays the "success" page.
HTH
Jirka
--
You receiv
that after
> successfully processing a form uses HttpResponseRedirect() to send the user
> to a 'success' page. Is their a standard way of accessing the form data
> from the previous page so that I can echo some of the submitted data back
> to them?
>
> Simon
>
> --
> You
Hi All, I'm just starting to play around with Django... working through the
tutorial and the Django Book. I have just written a view that after
successfully processing a form uses HttpResponseRedirect() to send the user
to a 'success' page. Is their a standard way of accessing the
-0700, Mike wrote:
>
>
> On Saturday, August 18, 2012 1:31:42 PM UTC+2, Paul Backhouse wrote:
> > I seem to be getting a DeprecationWarning when my view hits
> this line of
> > code:
> >
> > return HttpRespons
On Saturday, August 18, 2012 1:31:42 PM UTC+2, Paul Backhouse wrote:
>
> > I seem to be getting a DeprecationWarning when my view hits this line
> of
> > code:
> >
> > return HttpResponseRedirect(reverse(results, args=[query.jobid]))
> >
>
&
> I seem to be getting a DeprecationWarning when my view hits this line of
> code:
>
> return HttpResponseRedirect(reverse(results, args=[query.jobid]))
>
What does the depreciation warning say?
--
You received this message because you are subscribed to the Google Groups
I seem to be getting a DeprecationWarning when my view hits this line of
code:
return HttpResponseRedirect(reverse(results, args=[query.jobid]))
I'm not directly using any generic views here. Is this a bug? If not,
what is the right way to redirect to a different view? That line of
I saw that post and set request.session.modified = True before redirecting
in the view with no luck!
Any other ideas?
Thanks,
-Moe
On Sun, Jul 1, 2012 at 4:08 PM, Alagappan wrote:
> I think someone has faced a similar issue as yours. Find more details at:
>
> http://stackoverflow.com/question
Hello,
Why is it that the session id changes after a redirect is initiated from a
view function? This is basically the scenario, after the browser makes a
POST request to a custom login() view function, the view function
authenticates the user and redirects (302) the user back to a page, but the
r
Set request.session.modified = True
2012/4/24 sspross :
> Hi Joshua
>
> What was your solution here? It looks like I'm having the same kind of
> problem like you:
>
> http://stackoverflow.com/questions/10293467/losing-session-after-httpresponseredirect
>
> Thx!
Hi Joshua
What was your solution here? It looks like I'm having the same kind of
problem like you:
http://stackoverflow.com/questions/10293467/losing-session-after-httpresponseredirect
Thx!
Regards,
Silvan
On Wednesday, April 1, 2009 4:47:17 AM UTC+2, Joshua K wrote:
>
>
support a request and can
> do the validation why not? Basically stuck on using
> HttpResponseRedirect in a context processor. I have managed to get
> this working by passing a variable called redirect in the dictionary
> returned to my template and then saying if the redirect tag is
>
lidation why not? Basically stuck on using
> HttpResponseRedirect in a context processor. I have managed to get
> this working by passing a variable called redirect in the dictionary
> returned to my template and then saying if the redirect tag is
> available use the browsers meta tag
context processor after is_valid is
called. Are context processors not supposed ot be used in this way? My
thoughts inititally were that if it seems to support a request and can
do the validation why not? Basically stuck on using
HttpResponseRedirect in a context processor. I have managed to get
this
Thanks for the explanation. We ended up re-arranging which pieces were
listening on which ports so the nginx front end is on port 80. Reading the
nginx docs, it seems like we might have been able to make our current set up do
what we wanted, but shuffling the ports was easier :-)
Regarding:
On Tue, Aug 23, 2011 at 4:01 PM, Jacob Kaplan-Moss wrote:
> However, I believe it's not actually Django doing the rewriting.
Scratch that: I'm wrong. Actually, Django *is* doing the re-writing:
see
https://code.djangoproject.com/browser/django/trunk/django/http/utils.py#L11.
Still, the point st
API clients, testing utilities, ...).
However, I believe it's not actually Django doing the rewriting. if
you peer through the implementation of HttpResponseRedirect
(https://code.djangoproject.com/browser/django/trunk/django/http/__init__.py#L689),
you'll see that i there's nowhere
I've got a view which does returns HttpResponseRedirect('/'). When I look at
the HTTP traffic in tcpdump, I can see that the location header has had the
hostname added:
Location: http://gilbert.lic.songza.com/
Why does it do this? It seems like it should just take the string I
On Mon, Dec 20, 2010 at 10:02 AM, Mingming Wang wrote:
> Thanks a lot Javier! It takes me days to understand this.
> Hm...what if we don't use Redirect, what will happen in the wire? is it the
> following? If so, then no re submit problem lor. I must missed something
> out.
> <- GET /yourapp/vote
edirect or a direct response? Refer the
> > comments below. Thanks a lot!
>
> HttpResponseRedirect returns a 301 or 302 response code to the
> browser, instead of more common 200 (ok), or 404 (not found). That
> simply instructs the browser to load the given URL. The interestin
On Sat, Dec 18, 2010 at 11:06 AM, Mingming Wang wrote:
> From the tutorial of Django, there is the following code in here
> Who knows the mechanism behind a redirect or a direct response? Refer the
> comments below. Thanks a lot!
HttpResponseRedirect returns a 301 or 302 response co
hanks a lot!
from django.shortcuts import get_object_or_404, render_to_responsefrom
django.http import HttpResponseRedirect, HttpResponsefrom
django.core.urlresolvers import reversefrom django.template import
RequestContextfrom polls.models import Choice, Poll# ...def vote(request,
poll_id):
p =
est,
'show_admin' : request.user.is_authenticated(),
'ty_message' : ty_messages.get(ty_msg_id,
ty_messages['']),
})
t = get_template('ThankYou.html')
html = t.render(c)
return HttpResponse(html)
# usage example
return H
er.is_authenticated(),
'ty_message' : ty_messages.get(ty_msg_id,
ty_messages['']),
})
t = get_template('ThankYou.html')
html = t.render(c)
return HttpResponse(html)
# usage example
return HttpResponseRedirect('/ThankYou/0089'
Dnia 07-08-2010 o 10:29:30 bagheera napisał(a):
Dnia 06-08-2010 o 18:09:12 shacker napisał(a):
Why not use the Messages framework for this?
http://docs.djangoproject.com/en/dev/ref/contrib/messages/
./s
That looks promising, i'll try to figure that out.
It works as intended, thanks sha
Dnia 06-08-2010 o 18:09:12 shacker napisał(a):
Why not use the Messages framework for this?
http://docs.djangoproject.com/en/dev/ref/contrib/messages/
./s
That looks promising, i'll try to figure that out.
--
Linux user
--
You received this message because you are subscribed to the Google
Why not use the Messages framework for this?
http://docs.djangoproject.com/en/dev/ref/contrib/messages/
./s
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from
Daniel, I think it can work incorrectly when user would be filling
more than one form of the same type at the same time. My suggestion is
to use passing get parameters while returning HttpResponseRedirect. It
of course have disadvantage that the address would not be always same
(get params will be
So when returning HttpResponseRedirect django returns 302 status code
for the client, which indicates that the client browser should
navigate to another url. Then you have at last 2 options:
1) before returning save at session data information about form that
you want to thans form - but it'
directs to "/' if no redirection took place (like user typed in browser
> "test.com/thanks")
> Unfortunately, HttpResponseRedirect takes only one argument. How can i
> pass right message anyway? Or mb there is some workaround, like i could
> check in &quo
ce (like user typed in browser
"test.com/thanks")
Unfortunately, HttpResponseRedirect takes only one argument. How can i
pass right message anyway? Or mb there is some workaround, like i could
check in "thanks" view, from what page it was redirected?
--
Linux user
--
You r
I finally went half and half here, by posting to an /vote//
url. Personally, I think handling the GET in the tag and the POST in a
view is a bit messy, but perhaps I find a better solution later.
After I got that to work properly, I also implemented an ajax version.
I have never done that in Django
On Thu, May 13, 2010 at 6:11 PM, marty3d wrote:
> Thanks, that's a shame...
> So I'm now trying to do the request.POST stuff in a view instead.
> Since the idea is to have the voting app as decoupled as possible, is
> there a slick way to pass, perhaps the whole object in this case, but
> at least
ust be a "ContentType"
instance.
new_vote.content_type =
ContentType.objects.get_for_id(form.cleaned_data['content_type'])
#This SHOULD work, right?
new_vote.save()
return HttpResponseRedirect('/news/1/') #To make dynamic once the
above code work
Thanks,
/Martin
On May 13, 8:14 pm,
On May 13, 6:11 pm, marty3d wrote:
> Thanks, that's a shame...
> So I'm now trying to do the request.POST stuff in a view instead.
> Since the idea is to have the voting app as decoupled as possible, is
> there a slick way to pass, perhaps the whole object in this case, but
> at least the name of
> > if form.is_valid():
> > new_vote = form.save(commit=False)
> > new_vote.object_id = object.pk
> > new_vote.content_type = item_type
> > new_vote.save()
> > retu
;POST':
> form = VoteForm(request.POST)
> if form.is_valid():
> new_vote = form.save(commit=False)
> new_vote.object_id = object.pk
> new_vote.content_type = item_type
new_vote.object_id = object.pk
new_vote.content_type = item_type
new_vote.save()
return HttpResponseRedirect(request.path)
else:
form = VoteForm()
return {
On May 4, 9:43 am, xpanta wrote:
> Thank you. One more thing: how to save info in the session?
Read the fine documentation:
http://docs.djangoproject.com/en/1.1/topics/http/sessions/
--
DR.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To po
Thank you. One more thing: how to save info in the session?
On 4 Μάϊος, 11:27, "ge...@aquarianhouse.com"
wrote:
> i would use reverse and redirect to a "success" page
>
> def my_view(request):
> #do stufff
> #save info in session
> return Htt
i would use reverse and redirect to a "success" page
def my_view(request):
#do stufff
#save info in session
return HttpResponseRedirect(reverse('success_url'))
def my_success_view(request):
#access the session and get the data
return render_to_response(
Hi,
I am new to django, and I have this simple task i need to accomplish.
in views.py there is a function that processes an html form (with POST
action). This function returns an HttpResponseRedirect object. This
object gets as parameters the redirect action, like this: return
datetime.datetime.now(), result)
order_file.close()
return True if result else False
@login_required
def store_config(request):
# get store for user, see if user can edit settings
profile = check_perms(request, 'can_edit_settings')
if profile == 'error'
It worked as follows:
return HttpResponseRedirect('/userans/%s/%s/' % (uno,qno))
Thank you for helping..
On Sat, Jan 16, 2010 at 3:36 PM, Daniel Roseman wrote:
> On Jan 16, 8:38 am, grp25 wrote:
> > The code which we have written is
> > re
message+': Phone '+phone +': Name '+name
from django.core.mail import send_mail
send_mail(subject, message, your_email,
['malc...@sporthill.com'])
else:
notes='Sorry, there was a problem with your
submission
you should "return HttpResponseRedirect"
Regards.
On Tue, Nov 17, 2009 at 5:04 PM, adrian wrote:
>
> The LOGIN_REDIRECT_URL setting points to this view, where I want to
> redirect again according to the group the user is in:
>
> @login_required
> def afte
r(groups[0].name)
if name == 'superadmin':
print "redir superadmin"
print reverse("superadminhome")
HttpResponseRedirect(reverse("superadminhome"))
print "here now"
elif name == 'ad
dijxtra wrote:
> Is it safe to use HttpResponseRedirect(request.META["HTTP_REFERER"])?
> Can a session be stolen using this coed by spoofing HTTP_REFERER?
Two things stand out to me:
1) HTTP_REFERER is not a required header, so if the browser
doesn't send it, your code won
Is it safe to use HttpResponseRedirect(request.META["HTTP_REFERER"])?
Can a session be stolen using this coed by spoofing HTTP_REFERER?
Thanks in advance,
nick
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Group
elf.as_widget()
>
> File "/home/pozzonuovo/django/django/forms/forms.py", line 391, in
> as_widget
> return widget.render(name, data, attrs=attrs)
>
> File "/home/pozzonuovo/django/django/contrib/admin/widgets.py", line
> 225, in re
min
> > action)
>
> > for example this works:
> > def add_mailing(self, request, queryset):
> > return HttpResponseRedirect('%s?subject=halo' % \
> > urlresolvers.reverse
> > ('admin:tend
ryset):
> return HttpResponseRedirect('%s?subject=halo' % \
> urlresolvers.reverse
> ('admin:tenders_mailing_add'))
>
> but this does not:
> def add_mailing(self, request, queryset):
> p
ks:
> def add_mailing(self, request, queryset):
> return HttpResponseRedirect('%s?subject=halo' % \
> urlresolvers.reverse
> ('admin:tenders_mailing_add'))
>
> but this does not:
> def add_m
HI everyone!
Can I redirect to view with form passing few variables in POST method
(request.POST) and showing them in the form? (i need this in admin
action)
for example this works:
def add_mailing(self, request, queryset):
return HttpResponseRedirect('%s?subject
Ticket #11638 ...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to
django-users+un
92. response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
decorators.py" in __call__
78. return self.view_func(request, *args, **kwargs)
File "/var/www/filez/filezupload/views.py&
1 - 100 of 208 matches
Mail list logo