Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6917353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:43:11+00:00 2026-05-27T09:43:11+00:00

I have successfully added my own custom HTML templates for the password reset pages

  • 0

I have successfully added my own custom HTML templates for the password reset pages in Django and it’s all working nicely. The only bit I can’t work out it how to include my own email subject.

The default is “Password reset on [my site name]” and I can obviously change the site name in admin but does anyone know how to override the whole subject line?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:43:12+00:00Added an answer on May 27, 2026 at 9:43 am

    Development Version

    Just create new file registration/password_reset_subject.txt in your templates dir. This will override default django subject

    See https://github.com/django/django/blob/master/django/contrib/auth/templates/registration/password_reset_subject.txt

    and https://github.com/django/django/blob/master/django/contrib/auth/forms.py line 150

    In Django 1.3

    if you use internalization just add in .po file

    #: forms.py:143
    #, python-format
    msgid "Password reset on %s"
    msgstr "YOUR SUBJECT HERE %s"
    

    if not folow next steps

    in root urls.py

    # change to your custom view
    (r'^password_reset/$', 'your_app.views.password_reset'),
    

    in your your_app/views.py

    from django.contrib.auth.views import password_reset as django_password_reset
    from .forms import CustomPasswordResetForm
    
    # reuse Django view, but change form
    def password_reset(*args, **kwargs):
        kwargs['password_reset_form'] = CustomPasswordResetForm
        django_password_reset(*args, **kwargs):
    

    rewrite save method in your your_app/forms.py (I know it not DRY but should work 🙂

    class CustomPasswordResetForm(PasswordResetForm):
        def save(self, domain_override=None, email_template_name='registration/password_reset_email.html',
             use_https=False, token_generator=default_token_generator, request=None):
            from django.core.mail import send_mail
            for user in self.users_cache:
                if not domain_override:
                    current_site = get_current_site(request)
                    site_name = current_site.name
                    domain = current_site.domain
                else:
                     site_name = domain = domain_override
                t = loader.get_template(email_template_name)
                c = {
                'email': user.email,
                'domain': domain,
                'site_name': site_name,
                'uid': int_to_base36(user.id),
                'user': user,
                'token': token_generator.make_token(user),
                'protocol': use_https and 'https' or 'http',
                }
                send_mail(_("YOUR SUBJECT HERE %s") % site_name,
                    t.render(Context(c)), None, [user.email])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a png icon, it's added successfully in my project, but not included
Have successfully gotten the csrf middleware working in express as per previous SO questions.
I have successfully used the Excel and Word addin templates in Visual studio 2008
i have successfully added input element into div, which looks like this : $(document).ready(function()
I have successfully added and used a Get action in my new REST-service in
I have a 3rd party .dll that I have successfully added as a reference
I've just followed this example from Wordpress and I have successfully added an extra
I have successfully added a dynamic library to a program, but when I try
I have successfully added the font Arial to TCPDF , however the filesize is
i use github and have successfully added and synched files on my laptop in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.