shivsharma07 / django-survey

Automatically exported from code.google.com/p/django-survey
0 stars 0 forks source link

Allow definition of 'next_page' in Survey model [patch attached] #38

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
There is currently the ability to add '?next=' to a URL when linking a user
to a survey. However I would like to be able to redirect a user to a page
unrelated to the survey when they submit their answers, without having to
manually set the ?next GET param each time I send a user to the survey. I
will be sending the survey link to my users via e-mail, and I want it to be
as neat & tidy as possible.

This patch adds a new option on the Survey model to add this functionality.
By defining the next_page on a Survey, the redirect will be done
automatically. If next_page is left blank, then the existing redirection
functionality is kept in place (eg it uses ?next, or shows the answers,
depending on the users permissions).

This is a very small change but provides quite useful functionality for my
particular use. I haven't discussed this on the list, but it fixes a pain
I've had for a while. Hopefully others find it useful, and it'd be nice to
see it put into trunk.

NOTE: You will need to complete a small schema change to make this work:

    UPDATE survey_survey ADD "next_page" varchar(200);

Original issue reported on code.google.com by rwpoul...@gmail.com on 3 Mar 2009 at 8:33

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi there, I applied your patch, but needed to make a small change line 48 from 
this:

return HttpResponseRedirect(request.survey.next_page or request.REQUEST['next'])

to this:

return HttpResponseRedirect(survey.next_page or request.REQUEST['next'])

Also at note to the developers, why do you inspect to see if
request.REQUEST['next'].startswith('http:') ? could not the next url by 
relatively
addressed?

thanks for sharing your code. i will let you know how i go.

thanks
ben.

Original comment by mr.benw...@gmail.com on 21 Jul 2009 at 5:52