> I have done the following, and it works most of the time for me: > > def index(request): > user = request.user > if user.is_authenticated(): > if user.is_superuser: > return redirect('/admin') > > judge = None > participant = None > competition = None > try: > participant = user.participant or None > judge = user.judge or None > if participant: > competition = participant.competition > if judge: > competition = judge.competition > except Participant.DoesNotExist, e: > pass > except Judge.DoesNotExist, e: > pass > except Exception, e: > raise > # Do some more stuff...
Actually this *doesn't* work most of the time for me, because the moment user.participant raises an exception I'm screwed. -- 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.