我创建了一个自定义后端,无需编辑django注册代码即可在html中激活电子邮件
(参考文献django+ send email in html with django-registration,最后一个答案)
这是后端,存储在core/registration/backends/htmldefault/__init__.py中,就像存储在registration/backends/__init__.py中的DefaultBackend一样
from registration.forms import RegistrationForm
from core.models import HtmlRegistrationProfile
class HtmlDefaultBackend(object):
#etc same as DefaultBackend but using HtmlRegistrationProfile instead of RegistrationProfile这是我的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')),
#...
)但我得到了
ImproperlyConfigured at /accounts/register/
Error loading registration backend core.registration.backends.htmldefault: "No module named registration.backends.htmldefault"由/registration/backends/__init__.py in get_backend, line 27抛出
我想问的是..。有没有可能在注册包之外有一个自定义的django注册后端?或者它必须像简单的和默认的后端一样存在于/registration/ backends /下?
发布于 2012-04-25 23:44:08
这是可能的。
__init__.py (可以为空)。https://stackoverflow.com/questions/10318572
复制相似问题