On 21-Jul-06, at 12:28 AM, Jacob Kaplan-Moss wrote:
> @login_required
> def report_list(request):
> context = {"reports" :
> Report.objects.filter(owner=request.user)}
> return render_to_response("report_list.html", context)
>
> (assuming, of course, a ``Report`` object with an ``owner`` FK to
> ``auth.User``)
one problem using login_required decorator is that it redirects to a
hardcoded path for the url. So unless you are hosting your site on
'/', you are out of luck. It is better to use user_passes_test and
put the test as 'not is_anonymous', because here you get to specifiy
the url to redirect to.
--
regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---