https://bitbucket.org/ubernostrum/django-profiles/issue/10/user-names-cant-have-periods-etc#comment-502428
On May 31, 5:17 pm, Andrew Sledge <andrew.j.sle...@gmail.com> wrote:
> Thank you Matias.
>
> Your syntax was a little off, but you did solve it. Here is the
> correct syntax:
>
> import profiles
> ...
> ...
> ...
> url(r'^profiles/(?P<username>[\w\.]+)/$',
> 'profiles.views.profile_detail', name='profiles_profile_detail'),
>
> I will submit a patch to django-profiles to support the characters
> "@/./+/-/_".
>
> On May 31, 5:00 pm, Matías Aguirre <matiasagui...@gmail.com> wrote:
>
>
>
>
>
>
>
> > This is the value for such url definition:
>
> > url(r'^(?P<username>\w+)/$', views.profile_detail, name='profiles_profile_detail'),
>
> > the rule uses \w+ which doesn't match the dot character. Example:
>
> > >>> import re
> > >>> r = re.compile('(\w+)')
> > >>> r.match('name.1').groups()
> > ('name',)
> > >>> r.match('.')
> > >>>
>
> > So, basically, django-profiles doesn't support usernames with dots characters,
> > you might need to override such URL.
>
> > url(r'^profiles/(?P<username>[\w\.]+)/$', views.profile_details,
> > name='profiles_profile_detail'),
> > url(r'^profiles/', include('profiles.urls')),
>
> > Makes sense?
>
> > Matías
>
> > Excerpts from Andrew Sledge's message of Tue May 31 17:51:15 -0300 2011:
>
> > > Don't think that has anything to do with it, but here goes...
>
> > > url(r'^profiles/', include('profiles.urls')),
>
> > > The remaining url config is provided by django-profiles.
>
> > > On May 31, 4:46 pm, Matías Aguirre <matiasagui...@gmail.com> wrote:
> > > > Hi,
>
> > > > Could you share the URL rule for profiles_profile_detail?
>
> > > > Matías
>
> > > > Excerpts from Andrew Sledge's message of Tue May 31 17:37:20 -0300 2011:
>
> > > > > 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?
>
> > > > --
> > > > Matías Aguirre <matiasagui...@gmail.com>
>
> > --
> > Matías Aguirre <matiasagui...@gmail.com>
--
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.
No comments:
Post a Comment