I haven't tried this, but it looks like you can use `django.core.urlresolvers.resolve(path_string)` to figure out if a view exists with a given path.
http://docs.djangoproject.com/en/dev/topics/http/urls/#django.core.urlresolvers.resolve http://docs.djangoproject.com/en/dev/topics/http/urls/#resolve I glanced at the code. It looks like this method will return None if there are no URLconf regex matches for the given path string. If a URLconf does match, it might potentially raise an exception. For your use case you probably want to treat the exceptions as matches/collisions and only validate successfully if None is returned. Again, I haven't tried this, but I'd guess it won't have any performance problems, since it's using Django's own (fast) URL routing infrastructure. Hope this helps, Ethan On Mon, Nov 2, 2009 at 10:05 AM, Sean Brant <brant.s...@gmail.com> wrote: > > So i have user profiles at http://domain.com/username. I'd like to > prevent a user from signing up with a username that is the same as a > page on my site (ie: /login/, /blog/, etc). I was thinking I could > inspect my url patterns to determine what pages exist so I can > prevent that from being a username. Although I'm not sure how > expensive that will be. I'd rather not have to maintain a list in my > settings file. Anyone know of a solution for this? Seems like a fairly > common use case. > > Sean > > > > --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---