Skip to content

Instantly share code, notes, and snippets.

Created February 21, 2012 17:09
Show Gist options
  • Save anonymous/1877462 to your computer and use it in GitHub Desktop.
Save anonymous/1877462 to your computer and use it in GitHub Desktop.
SO Question 9371802 - RY-ing
'''
urls.py adapted to use class-based views, even though i've been doing this typically with function-based views
'''
urlpatterns = patterns('',#'financialstuff.views',
(r'^$', HomeView.as_view()),
(r'^blah$', BlahView.as_view()),
(r'^Foo$', FooView.as_view()),
# and on and on
# and ocassionally as needed:
url(r'^Bar$', FooView.as_view(), name="bar_view"),
# based on replies and comments, however, it is recommended we do this ALL the time
# look at how much more code and repitition we are doing. it seems less readable to me as well.
url(r'^$', HomeView.as_view(), name="home_view"),
url(r'^blah$', BlahView.as_view(), name="blah_view"),
url(r'^Foo$', FooView.as_view(), name="foo_view"),
url(r'^Bar$', FooView.as_view(), name="bar_view"),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment