Hello, When defining URLs, I prefer named URLs. I like to define these names as constants, so I can use the contants in other files. Probably an old habit from my days as a Java developer, but I still think it is better than using the string all over the place. Here's an example:
URL_USER_REGISTER = 'user-register' URL_USER_ACCOUNT = 'user-account' urlpatterns = patterns('', url(r'^register/$', views.register, name = URL_USER_REGISTER), url(r'^accounts/$', views.account, name = URL_USER_ACCOUNT), ) Then, I can use urls. URL_USER_ACCOUNT for redirecting in my view code. Note that I'm using the view function directly in the url() function, rather than specifying a view name. That's because I like the extra layer of error checking: a missing view function can easily be detected by my IDE. The problem: I'm getting a circular import here. I cannot import the urls from the views and the views from the urls. Considering that I want to keep the above two practices (constants and passing view functions), is there a solution for that? I can take the constants to a separate module, but that seems like an overkill. Any suggestions? Thanks, Zviki -- 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.