2

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?

Community
  • 1
  • 1
apelliciari
  • 8,241
  • 9
  • 57
  • 92

1 Answers1

2

It is possible.

  1. Check if all your folders (core, registration, backends, htmldefault) have __init__.py (can be empty).

  2. Core folder is in project directory?

Denis Kabalkin
  • 508
  • 4
  • 15
  • 1
    2 stupid errors.. first your point 1, i didn't created the __init__.py in every folder (that was a very bad miss), then that path created conflicts with registration package.. now everything is working, thanks – apelliciari Apr 25 '12 at 22:07