示例#1
0
def approve(request, user_id):
    user = get_object_or_404(User, pk=user_id)
    if user:
        user.beneficiary.is_approved = True
        user.beneficiary.save()
        sendemail.delay(sub="approve_sub", msg="approve_msg",
                        to=user.email, user=user)
        return HttpResponseRedirect(reverse('customadmin:unapproved'))
    return render_to_response('unapproved_users.html')
示例#2
0
def approve(request, user_id):
    user = get_object_or_404(User, pk=user_id)
    if user:
        user.beneficiary.is_approved = True
        user.beneficiary.save()
        sendemail.delay(sub="approve_sub",
                        msg="approve_msg",
                        to=user.email,
                        user=user)
        return HttpResponseRedirect(reverse('customadmin:unapproved'))
    return render_to_response('unapproved_users.html')
示例#3
0
 def form_valid(self, form):
     user = form.save(commit=False)
     user.email = form.cleaned_data['email']
     user.save()
     self.person_klass_specific_stuff(form, user)
     user = authenticate(username=form.cleaned_data['username'],
                         password=form.cleaned_data['password1'])
     if user is not None and user.is_active:
         login(self.request, user)
         sendemail.delay(
             sub="reg_sub", msg="reg_msg", to=user.email, user=user)
     return super(RegistrationView, self).form_valid(form)
示例#4
0
 def form_valid(self, form):
     user = form.save(commit=False)
     user.email = form.cleaned_data['email']
     user.save()
     self.person_klass_specific_stuff(form, user)
     user = authenticate(username=form.cleaned_data['username'],
                         password=form.cleaned_data['password1'])
     if user is not None and user.is_active:
         login(self.request, user)
         sendemail.delay(sub="reg_sub",
                         msg="reg_msg",
                         to=user.email,
                         user=user)
     return super(RegistrationView, self).form_valid(form)