here is a better version of the code below while it still lasts:
http://dpaste.com/76325/

# the illest issue is right after the except clause. New accounts
should be
# logged in right after creation BUT the new account cannot
immediately log
# in. Whats the issue?

def create(request):
  ''' create an account if one does not exist else warn users to
handles that
  already exists and always offer the option to create a new
account.'''

  context = {
    'pagetype': 'create user form',
    'status_msg': 'create your desired username now'
  }

  if request.method == 'POST':

    username = request.POST['username']
    password = request.POST['password']
    email = request.POST['email']

    try:
      User.objects.get(username=username)  # must find better method!
      context['status_msg'] = 'Sorry that handle already exist'

    except ObjectDoesNotExist:
      User.objects.create_user(
        username=username,
        password=password,
        email=email,
      )

      authorized = auth.authenticate(username=username,
password=password)
      auth.login(request, authorized)  # USER DOES NOT LOG IN!
      context['status_msg'] = 'The account was successfully created'

  return render('create_user.html', context)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to