Re: Question on url routing

2014-10-14 Thread robert brook
I have figured out how to determine if the url_conf was obtained from an internal link (which would be the only acceptable workflow) or through a url that the user typed into the address bar trying to subvert the workflow. See the attached screen shot of the view. If the view goes through the e

Re: Question on url routing

2014-10-13 Thread Collin Anderson
Hi Robert, I once had a 4-step ecommerce checkout, and at one point, I considered using class based views for each step, and have a class method on each view that runs form validation on the current data in the database to see if the user is allowed to continue. It would then need to redirect b

Re: Question on url routing

2014-10-12 Thread Aliane Abdelouahab
in your class where you defined your 'private' link, you just redirects him everytime he clicks on it, or you make and if-else that is bound to the IP of the admin, so everytime the user clicks on it, he gets a 404 thinking that the link dont exist, else, the admin gets the right page. Le vendr

Re: Question on url routing

2014-10-11 Thread robert brook
Can you provide an example of custom logic Thanks On Friday, October 10, 2014 9:56:38 AM UTC-4, Vijay Khemlani wrote: > > I think in those cases you would need to add some custom logic to your > view to check whether the URL is valid for the "step" the user is in the > workflow. > > On Fri, Oct

Re: Question on url routing

2014-10-10 Thread robert brook
It would seem that this should be a common issue for any web site. based on the DRY principle, how has this been resolved by other developers On Friday, October 10, 2014 8:09:12 AM UTC-4, robert brook wrote: > > If I have 2 urls coded in the file for example > > url(r'^abc/$', views.abc), > url(

Re: Question on url routing

2014-10-10 Thread Vijay Khemlani
I think in those cases you would need to add some custom logic to your view to check whether the URL is valid for the "step" the user is in the workflow. On Fri, Oct 10, 2014 at 10:47 AM, robert brook wrote: > I know how to detect an ajax request. > > I am interested int the general issue of the

Re: Question on url routing

2014-10-10 Thread robert brook
I know how to detect an ajax request. I am interested int the general issue of the user typing in a valid url for the application, but not appropriate for the particular workflow. I utilize the @login_required decorater. I am looking for an analgous function to pass the user back to an approp

Re: Question on url routing

2014-10-10 Thread Collin Anderson
Do you mean ajax-only? def my_view(request): if not request.is_ajax(): return redirect('/a-valid-page/') https://docs.djangoproject.com/en/1.7/ref/request-response/#django.http.HttpRequest.is_ajax -- You received this message because you are subscribed to the Google Groups "Django

Re: Question on url routing

2014-10-10 Thread François Schiettecatte
Hi You could check request.META['HTTP_REFERER'], it should be set if the user clicks on a link and unset if the user entered the url in the address bar. Obviously this is browser dependent. If you really want to be sure I would use a one time url with a uuid which you generate and store to vali