Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8401051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:42:25+00:00 2026-06-09T21:42:25+00:00

My user registration flow has broken. I have the below code in views.py ,

  • 0

My user registration flow has broken. I have the below code in views.py, but receive a no user.url attribute error (as included beneath the views code). The user’s being created properly and I can navigate to the new user profile page, but the link’s broken. I can’t find info on the default user URL call.

Can you help?

views.py

def register(request):
    if request.method == 'POST':
        form = UserCreationForm(request.POST)
        if form.is_valid():
            new_user = form.save()
            new_user = authenticate(username = request.POST['username'],
                                    password = request.POST['password1'])
            login(request, new_user)
            return HttpResponseRedirect(new_user.url)
    else:
        form = UserCreationForm()
    return render_to_response("registration/register.html", {'form': form},
                              context_instance=RequestContext(request))

Error:

AttributeError at /register/
'User' object has no attribute 'url'
Request Method: POST
Request URL:    http://localhost:8000/register/
Django Version: 1.4.1
Exception Type: AttributeError
Exception Value:    
'User' object has no attribute 'url'
Exception Location: /home/methuselah/code/django/ssc/dev/ssc/crewcal/views.py in register, line 74
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:42:26+00:00Added an answer on June 9, 2026 at 9:42 pm

    The user object doesn’t have a url. If you want to set a url for every user, you’ll need to create an additional model with a relation to the user model.

    class UserAttribute(models.Model):
        user = models.OneToOneField(User)
        url = models.URLField(verify_exists=False, default="/home/page/")
    
        def __unicode__(self):
            return self.user.username
    

    I don’t know why you would want to set a unique url for every user though since you can retrieve the user on every request via request.user once they’re logged in.

    So you probably want to just do:

    return redirect('/profile/')
    

    and write another view to handle displaying of the profile. It’s tough to answer without more info about what you’re trying to accomplish.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple user registration page in my rails app that has two
In my user registration routine, i have this code : @user = User.new(attribs) @user.build_inventory(:max_slots
I'm making practice with CakePHP user registration validation but I get some error from
I have a user registration Form. If a new User register their account in
I have to do a user registration form (classical layout with two columns, labels
Let's say I have an user registration form. In this form, I have the
I have such view that handles user registration. After creating new user i want
I have created a user registration form in CakePHP. My intention is if user
I have made a user registration where I have salted the user password and
I have made customized user registration page. and i have made that on theme

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.