I'm using that page as a guide, and i've got a pages application that
has a registration_required boolean field setup.
In my urls file I've got this
(r'^login/$', 'django.contrib.auth.views.login'),
In my page view I'm doing this
print pg.registration_required
print request.user.is_authenticated()
if pg.registration_required and not request.user.is_authenticated():
return HttpResponseRedirect('/login/?next=%s' % request.path)
I've setup the auth middleware and pg is the page.
I can see that pg.registration_required is true, and that
request.user.is_authenticated() is false, so the code is trying to
send me to the login page.
The docs say to create registration/login.html as that is the default.
I've created a folder called registration in my templates folder, and
a page called login.html in that folder, but the site is still
throwing me a template not found error
Request Method: GET
Request URL: http://127.0.0.1:8000/login/?next=/helpline2/
Django Version: 1.3 beta 1 SVN-15046
Exception Type: TemplateDoesNotExist
Exception Value: registration/login.html
I must be doing something dull, anyone got any ideas?
On Mar 30, 11:02 am, Philip Mountifield <pmountifi...@formac.net>
wrote:
> If you want to use the existing permission system, I think you'll find
> this is what you need:https://docs.djangoproject.com/en/1.4/topics/auth/#the-permission-req...
>
> You could add some extra permissions to your models too if you need
> them:https://docs.djangoproject.com/en/1.4/ref/models/options/#permissions
>
> Kind regards
> Phil
>
> On 30/03/2012 10:28, vanderkerkoff wrote:
>
>
>
>
>
>
>
>
>
> > Hello there
>
> > I"m sure this question has been answered before but I just can't find
> > it, apologies.
>
> > We've got a django 1.1.2 site and I need to secure some sections of
> > the frontend, and use the users and groups model in the backend as the
> > database to provide authentication.
>
> > I really don't know where to start to be honest.
>
> > Any links to examples would be great.
>
> > What would be really great is if there's a way in the urls.py file to
> > do something like this.
>
> > from django.contrib.auth.models import *
> > urlpatterns += patterns('django.auth.authenticate',
> > (r'^specificurl$',")
> > )
>
> > If I get it working on specific URLS first, I can then start to work
> > out how to incorporate the login section into parts of the app. So
> > people could tick a page say as restricted, and then people would have
> > to login to see the page.
>
> > Any tips or links off to documentation would be really helpful.
>
> > Thanks
>
> --
>
> Philip Mountifield
> Formac Electronics Ltd
> tel +44 (0) 1225 837333
> fax +44 (0) 1225 430995
>
> pmountifi...@formac.netwww.formac.netwww.telgas.net
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment