Commits

fcoelho committed 2e369e3

custom app settings in models.py

Comments (0)

Files changed (3)

 
 from .utils import send_email
 
+# app settings
+SIGNUP_ACTIVATION_DAYS = getattr(settings, 'SIGNUP_ACTIVATION_DAYS', 2)
+SIGNUP_FORM_CLASS = getattr(settings, 'SIGNUP_FORM_CLASS', None)
+
 class ValidationManager(models.Manager):
 	def create_validation(self, user):
 		v = Validation(user=user)
 		context = {
 			'site': site,
 			'url': url,
-			'activation_days': getattr(settings, 'SIGNUP_ACTIVATION_DAYS', 2)
+			'activation_days': SIGNUP_ACTIVATION_DAYS
 		}
 
 		to = self.user.email
 from django.conf.urls import patterns, url, include
-from django.conf import settings
 
 from .views import SignUpView, SignUpCompleteView, ActivateView, ActivateCompleteView
 
 from django.views.generic.edit import FormView
 from django.views.generic.base import TemplateView
 from django.core.urlresolvers import reverse_lazy
-from django.conf import settings
 from django.contrib.auth import get_user_model
 from django.contrib.sites.models import get_current_site
 from django.shortcuts import redirect
 
-from .models import Validation
+from .models import Validation, SIGNUP_FORM_CLASS
 
 class SignUpView(FormView):
 	template_name = 'registration/signup_form.html'
 
 	def get_form_class(self):
 		if self.form_class is None:
-			form_class_name = getattr(settings, 'SIGNUP_FORM_CLASS', None)
+			form_class_name = SIGNUP_FORM_CLASS
 			if form_class_name is None:
 				from .forms import DefaultUserCreationForm
 				self.form_class = DefaultUserCreationForm