Created
October 6, 2012 17:54
-
-
Save mishudark/3845615 to your computer and use it in GitHub Desktop.
Django Dynamic Urls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # urls.py | |
| urlpatterns += patterns('', | |
| (r'^(?P<page_alias>.+?)/$', 'views.static_page'), | |
| ) | |
| # views.py | |
| def static_page(request, page_alias): # page_alias holds the part of the url | |
| try: | |
| active = Page.objects.get(page_alias=page_alias) | |
| except Page.DoesNotExist: | |
| raise Http404("Page does not exist") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment