On Tue, 2009-01-20 at 15:43 -0800, saved...@gmail.com wrote: > Hello Malcolm, > > Thanks for your reply. In response to your questions: > > > (a) what does "is_correct" contain when you think you should be entering > > the "correct" branch? Is it really something that will evaluate to >True in > > Python? > > In hindsight, "is_correct" was really not required and would not > evaluate to "true" in .py . It probably sprung from your own Complex > forms tutorial > http://www.pointy-stick.com/blog/2008/01/06/django-tip-complex-forms/ > > Perhaps replacing that with "if a.correct:" would be better idea?
There are a couple of errors in that post (and I'm going to update it one day), but is_correct() isn't any of them. I've defined is_correct() on my Form subclass. It's a method, not a property or an attribute, however, and it does return a boolean. You don't have to use something like my is_correct method, though, as you apparently now realise. It's just a handy utility function. That post is a précis of some more complex code in a real quiz application I wrote, and the utility functions like that saved a bunch of typing later on. > > > (b) What does q.next.get_absolute_url() return, if so? If, for example, > > you were returning an empty string, things could behave strangely. > > What I am trying to is to: > 1. Evaluate user's answer and > 2. If answer is correct, redirect to next question > else: > 3. Redisplay current question So, once you fix the is_correct bit, are you getting into that branch after a correct answer? If so, does q.next.get_absolute_url() return something sensible (print it out and see)? Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---