Tuesday, May 31, 2011

django-profiles and get_absolute_url

Hi All,

I am having trouble getting an absolute URL using the django-profiles
module with usernames that have periods in them (for instance "/
profiles/user.1").

Here is my profile class:

class UserProfile(models.Model):
user = models.ForeignKey(User, unique=True)
web_site = models.URLField(blank=True, null=True,
verify_exists=False)

@models.permalink
def get_absolute_url(self):
return ('profiles_profile_detail', (), {'username':
unicode(self.user.username)})

If the user name does not have a period in it, it returns a desirable
URL (for instance "/profiles/user1" and "/profiles/user_1" work).

I've tried forcing to unicode, to str, and leaving blank. I've even
forced UTF coding in the database using PRAGMA encoding="UTF-8";

Running out of ideas here...any thoughts?

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate