· 9 years ago · Sep 15, 2016, 05:42 PM
1class MyRegistrationView(RegistrationView):
2 def get_success_url(self,request, user):
3 return '/rango/'
4
5TypeError at /accounts/register/
6get_success_url() takes exactly 3 arguments (2 given)
7
8import os
9
10# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
11BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
12TEMPLATE_DIR =os.path.join(BASE_DIR, 'templates')
13STATIC_DIR = os.path.join(BASE_DIR, 'static')
14
15# Quick-start development settings - unsuitable for production
16# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
17
18# SECURITY WARNING: keep the secret key used in production secret!
19SECRET_KEY = '33^3v(lzc78duks9#q_8s+ji9+vf__3^e=9gm7mc9fsfa3i(e%'
20
21# SECURITY WARNING: don't run with debug turned on in production!
22DEBUG = True
23
24ALLOWED_HOSTS = []
25
26
27# Application definition
28
29INSTALLED_APPS = [
30 'django.contrib.admin',
31 'django.contrib.auth',
32 'django.contrib.contenttypes',
33 'django.contrib.sessions',
34 'django.contrib.messages',
35 'django.contrib.staticfiles',
36 'rango',
37 'registration',
38]
39
40MIDDLEWARE_CLASSES = [
41 'django.middleware.security.SecurityMiddleware',
42 'django.contrib.sessions.middleware.SessionMiddleware',
43 'django.middleware.common.CommonMiddleware',
44 'django.middleware.csrf.CsrfViewMiddleware',
45 'django.contrib.auth.middleware.AuthenticationMiddleware',
46 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
47 'django.contrib.messages.middleware.MessageMiddleware',
48 'django.middleware.clickjacking.XFrameOptionsMiddleware',
49]
50
51SESSION_EXPIRE_AT_BROWSER_CLOSE = True
52
53ROOT_URLCONF = 'tango_with_django_project.urls'
54
55TEMPLATES = [
56 {
57 'BACKEND': 'django.template.backends.django.DjangoTemplates',
58 'DIRS': [TEMPLATE_DIR],
59 'APP_DIRS': True,
60 'OPTIONS': {
61 'context_processors': [
62 'django.template.context_processors.debug',
63 'django.template.context_processors.request',
64 'django.contrib.auth.context_processors.auth',
65 'django.contrib.messages.context_processors.messages',
66 ],
67 },
68 },
69]
70
71WSGI_APPLICATION = 'tango_with_django_project.wsgi.application'
72
73# Passwords
74PASSWORD_HASHERS = [
75 'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
76 'django.contrib.auth.hashers.BCryptPasswordHasher',
77 'django.contrib.auth.hashers.PBKDF2PasswordHasher',
78 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
79]
80
81# User Registration using django-registration-redux
82# If True, users can register
83REGISTRATION_OPEN = True
84# One-week activation window; you may, of course, use a different value.
85ACCOUNT_ACTIVATION_DAYS = 7
86# If True, the user will be automatically logged in.
87REGISTRATION_AUTO_LOGIN = True
88# The page you want users to arrive at after they successful log in
89LOGIN_REDIRECT_URL = '/rango/'
90# The page users are directed to if they are not logged in,
91# and are trying to access pages requiring authentication
92LOGIN_URL = '/accounts/login/'
93
94# Database
95# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
96
97DATABASES = {
98 'default': {
99 'ENGINE': 'django.db.backends.sqlite3',
100 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
101 }
102}
103
104
105# Password validation
106# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
107
108AUTH_PASSWORD_VALIDATORS = [
109 {
110 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
111 },
112 {
113 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
114 'OPTIONS': { 'min_length': 6, }
115 },
116 {
117 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
118 },
119 {
120 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
121 },
122]
123
124
125# Internationalization
126# https://docs.djangoproject.com/en/1.9/topics/i18n/
127
128LANGUAGE_CODE = 'en-us'
129
130TIME_ZONE = 'UTC'
131
132USE_I18N = True
133
134USE_L10N = True
135
136USE_TZ = True
137
138
139# Static files (CSS, JavaScript, Images)
140# https://docs.djangoproject.com/en/1.9/howto/static-files/
141
142STATICFILES_DIRS = [STATIC_DIR, ]
143STATIC_URL = '/static/'