I created a custom backend to have activation emails in html without editing django-registration code
(ref. django+ send email in html with django-registration, last answer)
this is the backend, stored in core/registration/backends/htmldefault/__init__.py
, like DefaultBackend that is stored in registration/backends/__init__.py
from registration.forms import RegistrationForm
from core.models import HtmlRegistrationProfile
class HtmlDefaultBackend(object):
#etc same as DefaultBackend but using HtmlRegistrationProfile instead of RegistrationProfile
and this is my urls.py
urlpatterns = patterns('',
#...
url(r'^accounts/register/$', register, {'backend': 'core.registration.backends.htmldefault.HtmlDefaultBackend','form_class': UserRegistrationForm}, name='registration_register'),
url(r'^accounts/', include('registration.urls')),
#...
)
But i get
ImproperlyConfigured at /accounts/register/
Error loading registration backend core.registration.backends.htmldefault: "No module named registration.backends.htmldefault"
thrown by /registration/backends/__init__.py in get_backend, line 27
What i'm asking is.. is it possible to have a custom django-registration backend outside the registration package? Or it must live under /registration/backends/ like simple and default backends?
It is possible.
Check if all your folders (core, registration, backends,
htmldefault) have __init__.py
(can be empty).
Core folder is in project directory?