On 4/29/07, Ryan K <[EMAIL PROTECTED]> wrote: > > > On Apr 29, 4:26 am, Malcolm Tredinnick <[EMAIL PROTECTED]> > wrote: > > On Sun, 2007-04-29 at 03:47 +0000, Ryan K wrote: > > > Hi all...quick question. If I have the auth app enabled, is the user > > > object automatically exposed to templates used with generic views? I > > > want to display a login link if no one is logged in and a logout link > > > if a user is. > > > > Providing you have the Authentication and Session middleware modules in > > your MIDDLEWARE_CLASSES list, you will be able to do this. Details are > > > athttp://www.djangoproject.com/documentation/authentication/#authentica... > > > > Regards, > > Malcolm > > Ok thanks. Also, how do I make authentication required for the > direct_to_template generic view? >
You could create a wrapper view around the generic view as described in the "Extending Generic Views" section here http://www.djangobook.com/en/beta/chapter09/ and use the login_required decorator as described here: http://www.djangoproject.com/documentation/authentication/#the-login-required-decorator . - Robin --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---