Reputation: 2068
I want to override the send_activation_email in django-registration app in order to be able to send mail with html content instead of just text. Note that this function is defined in the models of the RegistrationManager model.
Thanks a lot in advance.
Upvotes: 1
Views: 402
Reputation: 1082
Use custom model, example:
from registration.models import RegistrationProfile
class CustomRegistrationProfile(RegistrationProfile):
"""
Custom registration profile
"""
class Meta:
proxy = True
def send_activation_email(self, site):
"""
Override method for custom send email
"""
Or, such a method override:
from registration.models import RegistrationProfile
def send_activation_email(self, site):
"""
Override method for custom send email
"""
RegistrationProfile.send_activation_email = send_activation_email
Upvotes: 1
Reputation: 827
As RegistrationProfile is a class, you can override it just like you would normally. So you can make an app (or just a file) and create a new proxy model, that will use your html email. (https://docs.djangoproject.com/en/dev/topics/db/models/#proxy-models)
When I had to do something similar last time, I changed the activation_email.txt file instead. That was a much quicker solution.
There might be an easier option though.
Upvotes: 0