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 6815545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:49:13+00:00 2026-05-26T20:49:13+00:00

I am trying to setup Django to have profiles for authors. It needs to

  • 0

I am trying to setup Django to have profiles for authors. It needs to be a really simple solution and I have what I believe should work:

Model

from django.contrib.auth.models import User
class MyProfile(models.Model):
    "Extends the user object for custom attr"
    user = models.OneToOneField(User)
    website = models.URLField(blank=True,null=True)
    websiteName = models.CharField(max_length=255,blank=True,null=True)
    twitterHandle=models.CharField(max_length=255,blank=True,null=True)
    bio = models.TextField()

    User.profile = property(lambda u: MyProfile.objects.get_or_create(user=u)[0])

    def __unicode__(self):
        return self.user

Settings

AUTH_PROFILE_MODULE = "btc_app.UserProfile"

However whenever I create a profile I get a type error:

Exception Value: coercing to Unicode: need string or buffer, User
found

My post data looks like this

POST

website u''
bio u'tttt'
_save   u'Save'
twitterHandle   u''
user    u'2'
websiteName u''
csrfmiddlewaretoken u'5af9526bc84673fc3338d63272804b92'

There is a drop down with all the users in it and it lets me pick one but for some reason the save fails… Any ideas?

Thanks,
CG

  • 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-05-26T20:49:13+00:00Added an answer on May 26, 2026 at 8:49 pm

    The problem is that in your unicode method you’re returning an user instance, try something like

    def __unicode__(self):
        return self.user.username
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying to setup django . I do have Django-1.1-alpha-1. I was trying
I'm trying to set up the simple syndication example from the Django docs, in
Trying to add django-registration to my app. I have installed setup tools to use
I'm new to Django (and Python) and I have been trying to work out
I am trying to setup django with fastcgi on apache. Django is installed and
I'm trying to setup django on a shared hosting provider. I followed the instructions
I am trying to setup Django to use MySQL. I am getting the following
I am trying to setup a website in django which allows the user to
My application uses Django non-rel . I don't have access to model. I have
The setup = I have this class, Transcript: class Transcript(models.Model): body = models.TextField('Body') doPagination

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.