Reputation: 2755
I am new to Django and trying to build a social networking site that requires these steps for new users:
Fill Registration forms -> Fill some profile forms -> Verify account from email -> Use
pip has installed Django 1.5.4.
My question is: For this Scenario, should I use Django-registraion or the native Django-auth or some other module? Which option would you recommend and why?
Upvotes: 1
Views: 264
Reputation: 545
django-allauth is a fairly complete solution. Even if you are not interested in the social login and integration features, it makes very easy for you to handle user registration, profile, email validation, etc.
Upvotes: 0
Reputation: 5263
It really depends on the level of customization you want to have.
A registration form could look a bit like repetitive task among different Django projects, and it is considering most of the registration processes require the same basic steps. However, for different projects you may need to extend or exclude certain steps.
This is an example of a view I use for registration:
def register(request):
if request.method == 'POST':
register_form = RegisterForm(request.POST)
if register_form.is_valid():
data = register_form.data
# create user
user = User.objects.create_user(
username=data.get('username'),
email=data.get('email'),
password=data.get('password'),
)
if user is not None:
auth = authenticate(username=data.get('username'), password=data.get('password'))
login(request, auth)
messages.success(request, _('Your new user has been created.'))
return redirect(reverse('home'))
else:
messages.error(request, _('Oops! Error.'))
else:
register_form = RegisterForm()
return render(request, 'accounts/register.html')
This works for almost all my projects. RegisterForm
has all the magic.
Upvotes: 1