def form_valid(self, form):
    user = RegistrationProfile.objects.create_inactive_user(username=form.cleaned_data['username'], password=form.cleaned_data['password'], email=form.cleaned_data['email'], site=1)
    profile = form.save(commit=False)
    profile.user_id = user.id
    profile.save()
    form.save_m2m()
    return HttpResponseRedirect(self.success_url)
def form_valid(self, form):
    user = RegistrationProfile.objects.create_inactive_user(username=form.cleaned_data['username'], password=form.cleaned_data['password'], email=form.cleaned_data['email'], site=1)
    profile = form.save(commit=False)
    profile.user_id = user.id
    profile.save()
    form.save_m2m()
    return HttpResponseRedirect(self.success_url)