Monday, May 31, 2010

Re: Built in password reset views resulting in Caught NoReverseMatch while rendering: Reverse for 'django.contrib.auth.views.password_reset_confirm'

Hi Mike,

Thanks for the response. I did think of that. My template loaders
setting is as follows:

TEMPLATE_LOADERS = (
'django.template.loaders.app_directories.Loader',
'django.template.loaders.filesystem.Loader',
)

all of my templates are stored in the template directory for each
individual Django application to save on cross dependencies or global
dependencies as I want to maximise the modularity of them. From
reading the docs the app_directories loader is the correct one for
this situation.

The problem with the filesystem loader is that you need to specify all
your template paths in the settings file, which is something I was
trying to avoid as the app_directories loader was what I wanted. I
guess the app_directories loader works on the order of apps listed in
the INSTALLED_APPS tuple?

On May 31, 2:05 am, Mike Dewhirst <mi...@dewhirst.com.au> wrote:
> Simon
>
> Have considered the sequence in which templates are loaded?
>
> Seehttp://docs.djangoproject.com/en/dev/ref/settings/
>
> If you put the filesystem template loader ahead of the app_directories
> django will find your own versions named identically with django
> versions and use them instead.
>
> TEMPLATE_LOADERS = (
>      'django.template.loaders.filesystem.load_template_source',
>      'django.template.loaders.app_directories.load_template_source',
> )
>
> hth
>
> Mike
>
> On 30/05/2010 11:49pm, Cromulent wrote:
>
>
>
> > Well I got it working by changing the names of my templates to
> > something other than the default value. This seems like a bug to me.
> > Surely Django should use a provided template if it is available and
> > only fall back on the built in ones as an absolute last resort?
> > Especially as I had specified in the dictionary the correct template
> > name and that they were available.
>
> > On May 30, 10:41 am, Cromulent<simon.con...@googlemail.com>  wrote:
> >> I'm using Django 1.2.1 on Mac OS X with Python 2.6.1 if that matters.
> >> I've read the documentation and this is what I have for my urls.py
> >> file:
>
> >> password_reset_dict = {
> >>      'post_reset_redirect' : '/profiles/login/',
> >>      'email_template_name' : 'registration/password_reset_email.html',
> >>      'template_name' : 'registration/password_reset_form.html',
>
> >> }
>
> >> password_reset_confirm_dict = {
> >>      'template_name' : 'registration/password_reset_confirm.html',
> >>      'post_reset_redirect':'/profiles/login/',
>
> >> }
>
> >> (r'^reset/$', 'django.contrib.auth.views.password_reset',
> >> password_reset_dict),
>
> >> (r'^reset/confirm/$',
> >> 'django.contrib.auth.views.password_reset_confirm', \
> >> password_reset_confirm_dict),
>
> >> (r'^reset/done/$', 'django.contrib.auth.views.password_reset_done'),
>
> >> (r'^reset/complete/$',
> >> 'django.contrib.auth.views.password_reset_complete'),
>
> >> The strange thing is that when the error comes back the generic view
> >> does not seem to be using the templates that I have specified in the
> >> dictionary, instead the error points to the internal
> >> password_reset_email.html template and this line in particular:
>
> >> {{ protocol }}://{{ domain }}{% url
> >> django.contrib.auth.views.password_reset_confirm uidb36=uid
> >> token=token %}
>
> >> I've done a fair bit of Googling and tried the various methods
> >> mentioned but the ones that seemed most promising require you to
> >> change the template and as it does not actually get to my template I'm
> >> at a bit of a loss.
>
> >> Can anyone tell me where I am going wrong with this at all?
>
> >> Any help is very much appreciated.

--
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