Yes. Tie it to the session.
Is the need for random IDs an attempt to keep users from figuring out how
to re-answer questions by composing URLs themselves? Just record which
questions they have answered, and ignore attempts to answer them again.
Or are random IDs some PHB's beloved mechanism that
Unfortunately, the ID is not unique, as every ID will be used 3 times in
each session. Is it still possible to use JavaScript as a solution?
Am Mittwoch, 27. Februar 2013 16:44:45 UTC+1 schrieb ke1g:
> Maria,
>
> If the id is truely unique (is never used again for another version of the
> poll)
Hi again Maria,
Try to combine the solutions proposed in those two pages:
http://stackoverflow.com/questions/2133166/loop-timer-in-javascript#2133217
http://stackoverflow.com/questions/948227/should-i-use-window-navigate-or-document-location-in-javascript#948242
That should be more than enough.
Maria,
If the id is truely unique (is never used again for another version of the
poll), then the fact that the browser visits the URL containing the ID
gives you a chance to note the missed question.
Separately, you may want to look into Django's session stuff, since you
then need not encode ans
Maria, that code (your "after three seconds") has to be run on the
client, so django has nothing to do with it. As Bill suggests, you
should try some javascript here.
On 02/27/2013 04:10 PM, Maria wrote:
> _like this:_
> if user clicks button
> save answer
> return HttpResponseRedirect ('/p
Hello Alan,
I'd love to learn something new but unfortunately I dont have the time
since my project is due very soon. Is there no easy or short way to get
this time variable into my code? Also, how do I "look for everything that
happens on the client-side"? I am sorry for my incompetence.. :D
*like this:*
if user clicks button
save answer
return HttpResponseRedirect ('/polls/'+str(sid))
else *after 3 seconds*
save this page for later
return HttpResponseRedirect ('/polls/'+str(sid))
--
You received this message because you are subscribed to the Google Groups
"Django users" gro
Hi Maria,
as Bill explained, you should be looking at JavaScript for everything
that happens on the client-side (i.e. after the page has left the server).
However you should consider shifting more of the logic to the
client-side in this case. For time-based actions with such a short
duration
Thank you Bill! I dont know if I got you but if I do it with JavaScript I
can't save the ID of the "missed" page, can I?
Because I want to save the page where no button was clicked to show it
again at the end of the poll, so that the user gets another chance to
answer this question.
Am Mittwo
You must do this using JavaScript in the user's browser. Look for time
based events in JavaScript, including how to cancel them if a button is
pressed. The button should still probably submit to the Django server for
recording, but you could simply record the fact that the correct
(pseudo-)random
Hi everyone! :)
I am working on a project for my studies, it is a web poll where you can
only answer yes or no by clicking on buttons.
If the user clicked on one button, the result will be saved in a text-file
and the user will be redirected to another page with a random id:
> return HttpR
11 matches
Mail list logo