Re: Re: how to redirect to a new page,but keep the browser's url unchanged
On 8/16/06, James Bennett <[EMAIL PROTECTED]> wrote: > Being able to see the correct current URL is a vital security feature > in web browsers, and (short of using JavaScript to open a new window > which lacks a location bar -- something not guaranteed to work because > browsers allow users to disable this ability) there is no way to > accomplish this. James, I agree that there are a lot of cases where this isn't a good idea, but who's to say that the mp3 file, for example, is *not* the correct resource for this URL? If the Django view only exists to determine the resource which should be presented to the browser, then an internal redirect would be exactly what you want. Chris, If you could determine that you want to present a certain mp3 file, using only the URL, then you could use Apache's rewrite rules to do exactly that, without forcing the browser to request a new page, and without involving Django at all. Unfortunately, once Apache has passed off a request to Django, you will have to use Django views to return your result. If it's absolutely necessary that a view return an mp3 file, then you could write a view that opens the file on the filesystem and streams the data out to the user. However, as mentioned in the documentation, (this is how Django serves up media with the development server,) this method is a) slow, b) prone to bugs, and c) not really what Django is best at For serving up static files, you're probably better off leaving them in a media directory, and letting Apache handle them, and just live with the URL bar showing the real location. Ian Clelland <[EMAIL PROTECTED]> --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: how to redirect to a new page,but keep the browser's url unchanged
You may want to take a look at this thread [1]. Particularly the responce by Ivan Sagalaev. Personally, I wouldn't want to serve (large) files that way, but I suppose it may be a requirement for some projects. If your just trying to restrict access, I'd go with Adrain's suggestion[2]. [1] http://groups.google.com/group/django-developers/browse_thread/thread/357606bb8248e7ac/ [2] http://www.djangoproject.com/documentation/apache_auth/ On 8/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > That works if i redirect a django view page to another django view > page. > what if i want to redirect to a non-django view page,like a mp3 file. > > Chris Long 写道: > -- Waylan Limberg [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: Re: how to redirect to a new page,but keep the browser's url unchanged
On 8/16/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > That works if i redirect a django view page to another django view > page. > what if i want to redirect to a non-django view page,like a mp3 file. Being able to see the correct current URL is a vital security feature in web browsers, and (short of using JavaScript to open a new window which lacks a location bar -- something not guaranteed to work because browsers allow users to disable this ability) there is no way to accomplish this. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: how to redirect to a new page,but keep the browser's url unchanged
That works if i redirect a django view page to another django view page. what if i want to redirect to a non-django view page,like a mp3 file. Chris Long 写道: > If you had two views: > > def view_1(request): > >return render_to_response(...) > > def view_2(request): > > return view_1(request) > > Will return the view_1 but will be under the view_2 URL. > > Chris --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
how to redirect to a new page,but keep the browser's url unchanged
If i use ResponseRedirect to redirect to a new page , the browser's url will change to the new url. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---
Re: how to redirect to a new page,but keep the browser's url unchanged
If you had two views: def view_1(request): return render_to_response(...) def view_2(request): return view_1(request) Will return the view_1 but will be under the view_2 URL. Chris --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~--~~~~--~~--~--~---