django-flash icon indicating copy to clipboard operation
django-flash copied to clipboard

Another redirect issue

Open abraxas opened this issue 14 years ago • 1 comments

I'm having an odd issue with a simple redirect scenario using the django builtin redirect shortcut.

I have a flash message set up... request.flash['message'] = "Test."

Then on the next line I redirect: return redirect('/teaminfo/'); #implied index

Works just fine. However, the more "correct" method doesn't:

return redirect('teaminfo.views.index')

The flash message disappears before my template file can present it. My url routing (in case it matters) is:

base:

urlpatterns = patterns('',
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
    (r'^admin/', include(admin.site.urls)),
    (r'^teaminfo/', include('teaminfo.urls')),
    (r'^$',"dashboard.views.index"),
)

application:

urlpatterns = patterns('teaminfo.views',
    (r'^player/(\d+)/edit',"edit_player"),
    (r'^$',"index"),
)

abraxas avatar Nov 05 '11 19:11 abraxas

Actually, I want to add a little bit more.

A little more experience is showing that it's more inconsistent than anything. It works in request, and fails in the next.

My log shows:

[05/Nov/2011 14:27:05] "POST /teaminfo/player/4/edit HTTP/1.1" 302 0 [05/Nov/2011 14:27:05] "GET /teaminfo/ HTTP/1.1" 200 5029 [05/Nov/2011 14:27:05] "GET /images/powered-by.png HTTP/1.1" 404 1770

(Ignore the 404 image, unless that's causing the problem...I haven't provided a file yet for that part.

abraxas avatar Nov 05 '11 19:11 abraxas