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

  • Home
  • SEARCH
  • 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 4577010
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:17:10+00:00 2026-05-21T20:17:10+00:00

I’m using the generic view django.contrib.auth.views.password_reset for the password reset form. In principle, it

  • 0

I’m using the generic view django.contrib.auth.views.password_reset for the password reset form. In principle, it all works, except that the subject line of the email that’s sent out contains ‘example.com’, as in: “Password reset on example.com”.

So I have looked around, but for the life of me I cannot find out how I can change this to contain my actual domain name.

Any ideas?

  • 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-21T20:17:11+00:00Added an answer on May 21, 2026 at 8:17 pm

    The PasswordResetForm sends the email based on your contrib.sites. It gets the domain name to use and passes it to the html template at registration/password_reset_email.html

    django/trunk/django/contrib/auth/forms.py:

    ...
    4     from django.contrib.sites.models import get_current_site
    ...
    
    123     def save(self, domain_override=None, email_template_name='registration/password_reset_email.html',
    124              use_https=False, token_generator=default_token_generator, from_email=None, request=None):
    125         """
    126         Generates a one-use only link for resetting password and sends to the user
    127         """
    128         from django.core.mail import send_mail
    129         for user in self.users_cache:
    130             if not domain_override:
    131                 current_site = get_current_site(request)
    132                 site_name = current_site.name
    133                 domain = current_site.domain
    134             else:
    135                 site_name = domain = domain_override
    136             t = loader.get_template(email_template_name)
    137             c = {
    138                 'email': user.email,
    139                 'domain': domain,
    140                 'site_name': site_name,
    141                 'uid': int_to_base36(user.id),
    142                 'user': user,
    143                 'token': token_generator.make_token(user),
    144                 'protocol': use_https and 'https' or 'http',
    145             }
    146             send_mail(_("Password reset on %s") % site_name,
    147                 t.render(Context(c)), from_email, [user.email])
    

    use admin or django shell to change the site

    read more about the sites framework here.

    How Django uses the sites framework

    Although it’s not required that you
    use the sites framework, it’s strongly
    encouraged, because Django takes
    advantage of it in a few places. Even
    if your Django installation is
    powering only a single site, you
    should take the two seconds to create
    the site object with your domain and
    name, and point to its ID in your
    SITE_ID setting.

    in shell you can do this by doing:

    >>> from django.contrib.sites.models import Site
    >>> my_site = Site(domain='some_domain.com', name='Some Domain')
    >>> my_site.save()
    >>> print my_site.id
    2
    >>>
    

    in your settings.py:

    SITE_ID = 2
    

    or

    >>> my_site = Site.objects.get(pk=1)
    >>> my_site.domain = 'somedomain.com'
    >>> my_site.name = 'Some Domain'
    >>> my_site.save()
    

    in your settings.py:

    SITE_ID = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.