urlpatterns = patterns( '', # Examples: # url(r'^$', 'baz.views.home', name='home'), # url(r'^baz/', include('baz.foo.urls')), # Comment the admin/doc line below to disable admin documentation: url(r'^%s/doc/' % ADMIN_BASE, include('django.contrib.admindocs.urls')), # Comment the next line to disable the admin: url(r'^%s/' % ADMIN_BASE, include(admin.site.urls)), url(r'^$', QuerySetBackedWellView.as_view( well_title='front_page', template_name="front_page.html", queryset=Article.published.all(), ), name='front_page'), url(r'^section/(?P<full_slug>[-\w/]+)', SimpleSectionView.as_view(template_name='section.html'), name='section_view'), url(r'^feed/section/(?P<full_slug>[-\w/]+)', SectionFeed(section_view='section_view'), name='section_feed'), url(r'^feed/all', ArticleFeed(title='Demo site articles', link='/', queryset=Article.objects.all()), name='all_articles_feed'), url(r'^article/(?P<slug>[-\w]+)/',
# Configure the basic Django media view to respond to requests. # # *Note*: You should not use this in production, but it's useful to have # for development purposes. url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), # ## Front Page # # This is an example of a `QuerySetBackedWellView` for loading articles # while using a well called `front_page`. `QuerySetBackedWellView` # requires a well to exist by default, but this is configured to work # even without a well because of the `allow_empty=True` kwarg. url(r'^$', QuerySetBackedWellView.as_view(well_title="front_page", allow_empty=True, template_name="index.html", queryset=Article.published.all()), name="home"), # ## Section Views # # Generate a section page. Note that it grabs a forward slash # (/) as well since it matches on the full slug. url(r'^section/(?P<full_slug>[-\w/]+)', SimpleSectionView.as_view(template_name='section.html'), name='section_view'), # Generate a basic RSS/Atom feed for any Section page. Like the # default Section view, this also grabs forward slashes as well. url(r'^feed/section/(?P<full_slug>[-\w/]+)', SectionFeed(section_view='section_view'),
# Comment the next line to disable the admin: url(r'^%s/' % ADMIN_BASE, include(admin.site.urls)), url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), # ## Creating a standard "front page" # # Below is an example of an adhoc QuerySetBackedWellView. You should # uncomment it if you used `armstrong load_demo_data` to create your # initial data set. # url(r'^$', QuerySetBackedWellView.as_view(well_title="Front Page", template_name="index.html", queryset=Article.published.all()), name="home"), url(r'^section/(?P<full_slug>[-\w/]+)', SimpleSectionView.as_view(template_name='section.html'), name='section_view'), url(r'^feed/section/(?P<full_slug>[-\w/]+)', SectionFeed(section_view='section_view'), name='section_feed'), url(r'^feed/all', ArticleFeed(title='Demo site articles', link='/', queryset=Article.objects.all()), name='all_articles_feed'),
urlpatterns = patterns('', # Examples: # url(r'^$', '{{ project_name }}.views.home', name='home'), # url(r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')), # Comment the admin/doc line below to disable admin documentation: url(r'^%s/doc/' % ADMIN_BASE, include('django.contrib.admindocs.urls')), # Comment the next line to disable the admin: url(r'^%s/' % ADMIN_BASE, include(admin.site.urls)), # {% if demo %} url(r'^$', QuerySetBackedWellView.as_view(well_title='front_page', template_name="front_page.html", queryset=Article.published.all(), ), name='front_page'), # {% else %} # Below is an example well view that might be used to display a well named # 'front_page' allowing for placement of content on the home page. The view # will work after # running `armstrong loaddata fixtures/initial_data.json` # #url(r'^$', QuerySetBackedWellView.as_view(well_title='front_page', # template_name="front_page.html", # queryset=Article.published.all()), # name='front_page'), # # Load the Armstrong "success" page by default url(r'^$', TemplateView.as_view(template_name="index.html")), # {% endif %}
from .utils import get_url_for_model urlpatterns = patterns( "", # Examples: # url(r'^$', 'baz.views.home', name='home'), # url(r'^baz/', include('baz.foo.urls')), # Comment the admin/doc line below to disable admin documentation: url(r"^%s/doc/" % ADMIN_BASE, include("django.contrib.admindocs.urls")), # Comment the next line to disable the admin: url(r"^%s/" % ADMIN_BASE, include(admin.site.urls)), url( r"^$", QuerySetBackedWellView.as_view( well_title="front_page", template_name="front_page.html", queryset=Article.published.all().order_by("-pub_date"), ), name="front_page", ), url( r"^section/(?P<full_slug>[-\w/]+)", SimpleSectionView.as_view(template_name="section.html"), name="section_view" ), url(r"^feed/section/(?P<full_slug>[-\w/]+)", SectionFeed(section_view="section_view"), name="section_feed"), url( r"^feed/all", ArticleFeed(title="Demo site articles", link="/", queryset=Article.objects.all()), name="all_articles_feed", ), url( r"^article/(?P<slug>[-\w]+)/",