#coding=utf-8 #URLS for Coltrane app from coltrane.models import Entry, Category from coltrane.views import CategoryDetailView from django.conf.urls import patterns, include, url from django.views.generic.list import ListView from django.views.generic.detail import DetailView from django.views.generic.dates import DateDetailView, YearArchiveView, MonthArchiveView, DayArchiveView from django.conf import settings entry_info_dict = { 'queryset': Entry.objects.all(), 'date_field': 'pub_date', } urlpatterns = patterns('', url(r'^(?P<year>\d{4})/{0,1}$', YearArchiveView.as_view(model=Entry, date_field="pub_date", make_object_list = True), name='coltrane_entry_archive_year'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/{0,1}$', MonthArchiveView.as_view(model=Entry, date_field="pub_date", month_format="%m"), name='coltrane_entry_archive_month'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/{0,1}$', DayArchiveView.as_view(model=Entry, date_field="pub_date", month_format="%m"), name='coltrane_entry_archive_day'), url(r'(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/{0,1}$', DateDetailView.as_view(model=Entry, date_field="pub_date", month_format="%m"), name='coltrane_entry_detail'), ) urlpatterns += patterns('', url(r'^categories/{0,1}', ListView.as_view(model=Category), name='coltrane_category_list'), url(r'^categories/(?P<slug>[-\w]+)/{0,1}$', CategoryDetailView.as_view(), name="coltrane_category_detail"), url(r'/{0,1}$', 'coltrane.views.category_list'), )
date_field = 'fecha_publicacion', paginate_by= 5, allow_empty= True, queryset= Noticia.live.all()), name='noticia_year'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$', MonthArchiveView.as_view( date_field= 'fecha_publicacion', month_format = '%m', paginate_by= 5, allow_empty= True, queryset= Noticia.live.all()), name='noticia_mes'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', DayArchiveView.as_view( date_field= 'fecha_publicacion', month_format = '%m', paginate_by= 5, allow_empty= True, queryset= Noticia.live.all()), name='noticia_dia'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view( slug_field = 'slug', date_field= 'fecha_publicacion', month_format = '%m', #model= Noticia), queryset= Noticia.live.all()), name='noticia-detalle'), )
} urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^search/$', search), url(r'^weblog/$', ArchiveIndexView.as_view(model=Entry, date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/$', YearArchiveView.as_view(model=Entry, date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/$', MonthArchiveView.as_view(model=Entry, date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', DayArchiveView.as_view(model=Entry, date_field="pub_date")), url( r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(model=Entry, date_field="pub_date")), url(r'^weblog/$', ArchiveIndexView.as_view(model=Link, date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/$', YearArchiveView.as_view(model=Link, date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/$', MonthArchiveView.as_view(model=Link, date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', DayArchiveView.as_view(model=Link, date_field="pub_date")), url( r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(model=Link, date_field="pub_date")), url(r'', include('django.contrib.flatpages.urls')), url(r'^categories/$', ListView.as_view(queryset=Category.objects.all())), url(r'^categories/(?P<slug>[-\w]+)/$', category_detail), url(r'^tags/$', ListView.as_view(queryset=Tag.objects.all())),
urlpatterns = patterns('django.views.generic.dates', #url(r'^/{0,1}$', 'coltrane.views.entries_index'), url(r'^$', ArchiveIndexView.as_view(queryset=Entry.live.all(), date_field='pub_date'), name='coltrane_entry_archive_index'), url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(queryset=Entry.live.all(), date_field='pub_date'), name='coltrane_entry_archive_year'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/{0,1}$', MonthArchiveView.as_view(queryset=Entry.live.all(), date_field='pub_date'), name='coltrane_entry_archive_month'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', DayArchiveView.as_view(queryset=Entry.live.all(), date_field='pub_date'), name='coltrane_entry_archive_day'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(queryset=Entry.live.all(), date_field='pub_date'), name='coltrane_entry_detail'), )
from django.conf.urls import url from django.views.generic.dates import DateDetailView from . import views from .models import Post qs = Post.objects.filter(type='post', status='publish') urlpatterns = [ url(r'^$', views.index, name='djwp_index'), url(r'^(?P<year>\d+)/(?P<month>[^/]+)/(?P<day>\d+)/(?P<slug>[^/]+)/$', DateDetailView.as_view( queryset=qs, date_field='pub_date', month_format='%m'), name='djwp_detail'), ]
from django.conf.urls.defaults import * from django.views.generic.dates import YearArchiveView, MonthArchiveView, DayArchiveView, DateDetailView from blog.models import Entry entry_info_dict = {'queryset':Entry.live.all(), 'date_field': 'pub_date', } urlpatterns = patterns('', # Pagination for the equivalent of archive_index generic view. # The url is of the form http://host/page/4/ # In urls.py for example, ('^blog/page/(?P<page>\d)/$', get_archive_index), url(r'^$', 'blog.views.get_archive_index_first', ), url(r'^page/(?P<page>\d)/$', 'blog.views.get_archive_index', ), #(r'^$', 'django.views.generic.date_based.archive_index', entry_info_dict, 'blog_entry_archive_index'), #(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(), entry_info_dict, 'blog_entry_archive_year'), url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(**entry_info_dict), name= 'blog_entry_archive_year'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', MonthArchiveView.as_view(**entry_info_dict), name= 'blog_entry_archive_month'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', DayArchiveView.as_view(**entry_info_dict), name= 'blog_entry_archive_day'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(**entry_info_dict), name= 'blog_entry_detail'), )
from django.conf.urls import patterns, url from django.views.generic.list import ListView from videogallery.models import Video from django.views.generic.dates import DateDetailView video_view_params = {'queryset': Video.objects.all(), 'date_field': "pub_date"} urlpatterns = patterns('', # url(r'^/videogallery/?', ListView.as_view(model=Video), # name='videogallery_list'), url(r'^/videogallery/?', 'videogallery.views.video_list', name='videogallery_video_list'), url(r'^/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/?$', DateDetailView.as_view(**video_view_params), name='videogallery_video_detail'), )
from django.conf.urls import patterns from blog.models import BlogItem from blog.feeds import RssBlogFeed from community.summary import get_latest_news from django.views.generic.dates import YearArchiveView, MonthArchiveView, DayArchiveView from django.views.generic.dates import DateDetailView from django.views.generic.list import ListView info_dict = { 'queryset' : BlogItem.objects.all(), 'date_field' : 'pub_date', 'extra_context' : get_latest_news() } urlpatterns = patterns( (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[A-Za-z0-9-_]+)/$', DateDetailView.as_view(slug_field='slug')), (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', DayArchiveView.as_view()), (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', MonthArchiveView.as_view()), (r'^(?P<year>\d{4})/$', YearArchiveView.as_view, info_dict), (r'^rss/latest/$', RssBlogFeed), )
from django.conf.urls import * from django.views.generic.dates import ArchiveIndexView, YearArchiveView, MonthArchiveView, DayArchiveView, DateDetailView from jraywo.models import Link urlpatterns = patterns('', url(r'^$', ArchiveIndexView.as_view(model=Link, date_field='pub_date', allow_empty = True, paginate_by = 5), name='jraywo_link_archive_index'), url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(model=Link, date_field='pub_date', make_object_list=True, allow_empty = True, paginate_by = 5), name='jraywo_link_archive_year'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', MonthArchiveView.as_view(model=Link, date_field='pub_date', allow_empty = True, paginate_by = 5),name='jraywo_link_archive_month'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', DayArchiveView.as_view(model=Link, date_field='pub_date', allow_empty = True, paginate_by = 5), name='jraywo_link_archive_day'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(model=Link, date_field='pub_date'), name='jraywo_link_detail'), )
from django.conf.urls import patterns from blog.models import BlogItem from blog.feeds import RssBlogFeed from community.summary import get_latest_news from django.views.generic.dates import YearArchiveView, MonthArchiveView, DayArchiveView from django.views.generic.dates import DateDetailView from django.views.generic.list import ListView info_dict = { 'queryset' : BlogItem.objects.all(), 'date_field' : 'pub_date', } #extra_dict = { # 'slug_field' : 'slug', # 'extra_context' : get_latest_news(), #} urlpatterns = patterns('', (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[A-Za-z0-9-_]+)/$', DateDetailView.as_view(**info_dict)), (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', DayArchiveView.as_view(**info_dict)), (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', MonthArchiveView.as_view(**info_dict)), (r'^(?P<year>\d{4})/$', YearArchiveView.as_view(**info_dict)), (r'^rss/latest/$', RssBlogFeed), )
from django.conf.urls.defaults import * from django.views.generic.base import TemplateView from django.views.generic.dates import ArchiveIndexView, DateDetailView from models import Entry, Tag entry_dict = { 'queryset': Entry.objects.filter(is_draft=False), 'date_field': 'published_on', } tag_dict = { 'queryset': Tag.objects.all(), } urlpatterns = patterns( 'django.views.generic', url(r'^/?$', ArchiveIndexView.as_view(**entry_dict), name="news-main"), url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[0-9A-Za-z-]+)/$', DateDetailView.as_view(slug_field='slug', month_format='%m', **entry_dict), name="news-detail"), url(r'^about/$', TemplateView.as_view(template_name='news/about.html'), name='news-about'), )
from django.conf.urls import patterns, url from django.views.generic.dates import ArchiveIndexView, YearArchiveView, MonthArchiveView, DayArchiveView, DateDetailView from coltrane.models import Entry urlpatterns = patterns('', url(r'^$', ArchiveIndexView.as_view(model=Entry, date_field='pub_date', queryset=Entry.live.all()), name='coltrane_entry_archive_index'), url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(model=Entry, make_object_list=True, queryset=Entry.live.all(), date_field='pub_date'), name='coltrane_entry_archive_year'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', MonthArchiveView.as_view(model=Entry, queryset=Entry.live.all(), date_field='pub_date'), name='coltrane_entry_archive_month' ), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', DayArchiveView.as_view(model=Entry, date_field='pub_date', queryset=Entry.live.all()), name='coltrane_entry_archive_day'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(model=Entry, date_field='pub_date', queryset=Entry.live.all()), name='coltrane_entry_details'), )
from coltrane.models import Link urlpatterns = patterns('django.views.generic.dates', url(r'^$', ArchiveIndexView.as_view(queryset=Link.objects.all(), date_field='pub_date'), name='coltrane_link_archive_index'), url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(queryset=Link.objects.all(), date_field='pub_date'), name='coltrane_link_archive_year'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', MonthArchiveView.as_view(queryset=Link.objects.all(), date_field='pub_date'), name='coltrane_link_archive_month'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', DayArchiveView.as_view(queryset=Link.objects.all(), date_field='pub_date'), name='coltrane_link_archive_day'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(queryset=Link.objects.all(), date_field='pub_date'), name='coltrane_link_detail'), )
app_name = 'drilldown' urlpatterns = [ path('archive/', ArchiveIndexView.as_view(model=Article, date_field="pub_date"), name="article_archive"), path('<int:year>/', ArticleYearArchiveView.as_view(), name="article_year_archive"), # Example: /2012/08/ path('<int:year>/<int:month>/', ArticleMonthArchiveView.as_view(month_format='%m'), name="archive_month_numeric"), # Example: /2012/aug/ path('<int:year>/<str:month>/', ArticleMonthArchiveView.as_view(), name="archive_month"), # Example: /2012/week/23/ path('<int:year>/week/<int:week>/', ArticleWeekArchiveView.as_view(), name="archive_week"), # Example: /2012/nov/10/ path('<int:year>/<str:month>/<int:day>/', ArticleDayArchiveView.as_view(), name="archive_day"), path('today/', ArticleTodayArchiveView.as_view(), name="archive_today"), path('<int:year>/<str:month>/<int:day>/<int:pk>/', DateDetailView.as_view(model=Article, date_field="pub_date"), name="archive_date_detail"), ]
queryset=Entry.live.all()), name='blog_entry_archive'), url(r'^author/(?P<id>[\d]+)/$', author_detail, name='blog_author_detail'), url(r'^category/$', ListView.as_view(queryset=Category.objects.all()), name='blog_category_list'), url(r'^category/(?P<slug>[-\w]+)/$', category_detail, name='blog_category_detail'), url(r'^feed/$', EntriesFeed(), name='blog_feed'), url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(date_field='pub_date', make_object_list=True, queryset=Entry.live.all()), name='blog_entry_archive_year'), url(r'^(?P<year>\d{4})/(?P<month>[-\w]+)/$', MonthArchiveView.as_view(date_field='pub_date', queryset=Entry.live.all()), name='blog_entry_archive_month'), url(r'^(?P<year>\d{4})/(?P<month>[-\w]+)/(?P<day>\d{2})/$', DayArchiveView.as_view(date_field='pub_date', queryset=Entry.live.all()), name='blog_entry_archive_day'), url(r'^(?P<year>\d{4})/(?P<month>[-\w]+)/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view( date_field='pub_date', queryset=Entry.objects.exclude(status=Entry.HIDDEN_STATUS), ), name='blog_entry_detail'), ]
ArchiveIndexView.as_view( queryset=Blog.objects.all(), date_field='pub_date', ), name='blog_archive_index'), url(r'^archive/(?P<year>\d{4})/$', YearArchiveView.as_view( queryset=Blog.objects.all(), date_field='pub_date', ), name='blog_archive_index_year'), url(r'^archive/(?P<year>\d{4})/(?P<month>\d{2})/$', MonthArchiveView.as_view(queryset=Blog.objects.all(), date_field='pub_date', month_format='%m'), name='blog_archive_index_month'), url(r'^archive/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{1,2})/$', MonthArchiveView.as_view(queryset=Blog.objects.all(), date_field='pub_date', month_format='%m'), name='blog_archive_index_day'), url(r'^archive/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(model=Blog, context_object_name='blog', date_field='pub_date', month_format='%m'), name='blog_detail'), url(r'^$', 'ddtcms.blog.views.index', name='blog_index'), url(r'^post/$', 'ddtcms.blog.views.post'), )
from django.conf.urls import patterns, url from django.views.generic.list import ListView from videogallery.models import Video from django.views.generic.dates import DateDetailView video_view_params = {'queryset': Video.objects.all(), 'date_field': "pub_date"} urlpatterns = patterns( '', # url(r'^/videogallery/?', ListView.as_view(model=Video), # name='videogallery_list'), url(r'^/videogallery/?', 'videogallery.views.video_list', name='videogallery_list'), url(r'^/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/?$', DateDetailView.as_view(**video_view_params), name='videogallery_video_detail'), )
url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(date_field='fecha_publicacion', paginate_by=15, allow_empty=True, queryset=Resumen.live.all()), name='resumen_year'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$', MonthArchiveView.as_view(date_field='fecha_publicacion', month_format='%m', paginate_by=15, allow_empty=True, queryset=Resumen.live.all()), name='resumen_mes'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', DayArchiveView.as_view(date_field='fecha_publicacion', month_format='%m', paginate_by=15, allow_empty=True, queryset=Resumen.live.all()), name='resumen_dia'), url( r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view( slug_field='slug', date_field='fecha_publicacion', month_format='%m', #model= Resumen), queryset=Resumen.live.all()), name='resumen-detalle'), )
paginate_by=settings.POSTS_PER_PAGE, allow_empty=True, queryset=Post.live.all(), context_object_name='posts', make_object_list=True, template_name='easyblog/posts/archive_year.html') archive_month_view = PostMonthArchiveView.as_view( date_field='publish_date', paginate_by=settings.POSTS_PER_PAGE, allow_empty=True, queryset=Post.live.all(), context_object_name='posts', template_name='easyblog/posts/archive_month.html', month_format='%m') archive_day_view = PostDayArchiveView.as_view( date_field='publish_date', paginate_by=settings.POSTS_PER_PAGE, allow_empty=True, queryset=Post.live.all(), context_object_name='posts', template_name='easyblog/posts/archive_day.html', month_format='%m') date_detail_view = DateDetailView.as_view( date_field='publish_date', queryset=Post.live.all(), context_object_name='post', template_name='easyblog/posts/detail.html', month_format='%m')
from django.conf.urls.defaults import patterns, url from blog.models import Post from blog.views import ArchiveCategoryView from django.views.generic.dates import ArchiveIndexView, YearArchiveView, MonthArchiveView, DateDetailView from blog.feeds import LatestEntriesFeed info = { 'model': Post, 'date_field': 'date', } urlpatterns = patterns('', url(r'^$', ArchiveIndexView.as_view(**info), name='blog-index'), url(r'^feed/$', LatestEntriesFeed(), name='blog-feed'), url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(**info), name='blog-archive-year'), url(r'^(?P<year>\d{4})/(?P<month>[A-z]{3})/$', MonthArchiveView.as_view(**info), name='blog-archive-month'), url(r'^(?P<category>[\w-]+)/$', ArchiveCategoryView.as_view(**info), name='blog-archive-category'), url(r'^(?P<year>\d{4})/(?P<month>[A-z]{3})/(?P<day>\d+)/(?P<slug>.+)/$', DateDetailView.as_view(**info), name='blog-post'), )
entry_info_dict = { 'queryset': Entry.objects.all(), 'date_field': 'pub_date', } link_info_dict = { 'queryset': Link.objects.all(), 'date_field': 'pub_date', } urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^search/$', search), url(r'^weblog/$', ArchiveIndexView.as_view(model=Entry, date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/$', YearArchiveView.as_view(model=Entry,date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/$',MonthArchiveView.as_view(model=Entry,date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',DayArchiveView.as_view(model=Entry,date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',DateDetailView.as_view(model=Entry,date_field="pub_date")), url(r'^weblog/$', ArchiveIndexView.as_view(model=Link, date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/$', YearArchiveView.as_view(model=Link,date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/$',MonthArchiveView.as_view(model=Link,date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$',DayArchiveView.as_view(model=Link,date_field="pub_date")), url(r'^weblog/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',DateDetailView.as_view(model=Link,date_field="pub_date")), url(r'', include('django.contrib.flatpages.urls')), url(r'^categories/$',ListView.as_view(queryset=Category.objects.all())), url(r'^categories/(?P<slug>[-\w]+)/$',category_detail), url(r'^tags/$',ListView.as_view(queryset=Tag.objects.all())), ]
make_object_list=True, queryset=Entry.live.all() ), name='blog_entry_archive_year' ), url(r'^(?P<year>\d{4})/(?P<month>[-\w]+)/$', MonthArchiveView.as_view( date_field='pub_date', queryset=Entry.live.all() ), name='blog_entry_archive_month' ), url(r'^(?P<year>\d{4})/(?P<month>[-\w]+)/(?P<day>\d{2})/$', DayArchiveView.as_view( date_field='pub_date', queryset=Entry.live.all() ), name='blog_entry_archive_day' ), url(r'^(?P<year>\d{4})/(?P<month>[-\w]+)/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view( date_field='pub_date', queryset=Entry.objects.exclude(status=Entry.HIDDEN_STATUS), ), name='blog_entry_detail' ), )
from django.conf.urls.defaults import * from django.views.generic.base import TemplateView from django.views.generic.dates import ArchiveIndexView, DateDetailView from models import Entry, Tag entry_dict = { 'queryset': Entry.objects.filter(is_draft=False), 'date_field': 'published_on', } tag_dict = { 'queryset': Tag.objects.all(), } urlpatterns = patterns('django.views.generic', url(r'^/?$', ArchiveIndexView.as_view(**entry_dict), name="news-main"), url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[0-9A-Za-z-]+)/$', DateDetailView.as_view(slug_field='slug', month_format='%m', **entry_dict), name="news-detail"), url(r'^about/$', TemplateView.as_view(template_name='news/about.html'), name='news-about'), )
}), name='entries_in_month'), url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$', DayArchiveView.as_view(**{ 'queryset': get_latest_entries(), 'date_field': 'datetime', 'month_format': '%m', 'allow_empty': True, 'context_object_name': "entries", 'allow_future': True, 'paginate_by': settings.ENTRIES_PER_PAGE, 'template_name': '%s/entries_for_day.html' % settings.TEMPLATE_NAME, }), name='entries_on_date'), # an entry on a specific date url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[\w\d-]+)/$', DateDetailView.as_view(**{ 'queryset': get_latest_entries(), 'date_field': 'datetime', 'month_format': '%m', 'context_object_name': "entry", 'allow_future': True, 'template_name': '%s/detail.html' % settings.TEMPLATE_NAME }), name='show_post'), # feeds url(r'^feeds/latest/$', RSSLatestEntries(), name="rss_entries_latest"), url(r'^feeds/(?P<tag>[^/]+)/$', RSSEntriesTaggedWith(), name="rss_entries_tagged_with"), # search against entries url(r'^search/$', 'search', name='search'), # tags url(r'^tags/(?P<tag>[^/]+)/$', 'entries_tagged_with', name='entries_tagged_with'), )
make_object_list=True, template_name='easyblog/posts/archive_year.html' ) archive_month_view = PostMonthArchiveView.as_view( date_field='publish_date', paginate_by=settings.POSTS_PER_PAGE, allow_empty=True, queryset=Post.live.all(), context_object_name='posts', template_name='easyblog/posts/archive_month.html', month_format='%m' ) archive_day_view = PostDayArchiveView.as_view( date_field='publish_date', paginate_by=settings.POSTS_PER_PAGE, allow_empty=True, queryset=Post.live.all(), context_object_name='posts', template_name='easyblog/posts/archive_day.html', month_format='%m' ) date_detail_view = DateDetailView.as_view( date_field='publish_date', queryset=Post.live.all(), context_object_name='post', template_name='easyblog/posts/detail.html', month_format='%m' )
from django.conf.urls import patterns, url from django.views.generic.dates import ArchiveIndexView, YearArchiveView, MonthArchiveView, DayArchiveView, DateDetailView from coltrane.models import Link urlpatterns = patterns('', url(r'^$', ArchiveIndexView.as_view(model=Link, date_field='pub_date'), name='coltrane_link_archive_index'), url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(model=Link, make_object_list=True, date_field='pub_date')), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', MonthArchiveView.as_view(model=Link, date_field='pub_date')), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', DayArchiveView.as_view(model=Link, date_field='pub_date')), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(model=Link, date_field='pub_date'), name='coltrane_link_details'), )
from django.conf.urls import patterns, url from django.views.generic.list import ListView from photogallery.models import Photo from django.views.generic.dates import DateDetailView photo_view_params = {'queryset': Photo.objects.all(), 'date_field': "pub_date"} urlpatterns = patterns( '', url(r'^/photogallery/?', 'photogallery.views.render_albums', name='photogallery_list'), url(r'^/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/?$', DateDetailView.as_view(**photo_view_params), name='photogallery_photo_detail'), )
# ex: /wlether/5/ url(r'^(?P<pk>\d+)/$', views.ScanDetail.as_view(), name="scan_detail"), # ex: /wlether/5/5/detail/ url(r'^(?P<scan_id>\d+)/(?P<apoint_id>\d+)/detail/$', views.apoint_detail, name='apoint_detail'), # ex: /wlether/1234/12/12 url(r'^(?P<year>\d{4})/(?P<month>\d+)/(?P<day>\d+)/$', views.ScanDayArchive.as_view(month_format='%m'), name="archive_day"), url(r'^mpl', views.test_matplotlib, name='test_matplotlib'), url(r'^gr/(?P<scan_year>\d{4})/(?P<scan_month>\d+)/(?P<scan_day>\d+)/$', views.gr, name='gr'), url(r'^gr_aps_sl/(?P<scan_year>\d{4})/(?P<scan_month>\d+)/(?P<scan_day>\d+)/$', views.gr_aps_sl, name='gr_aps_sl'), url(r'^aps_pie/(?P<scan_year>\d{4})/(?P<scan_month>\d+)/(?P<scan_day>\d+)/$', views.aps_pie, name='aps_pie'), url(r'^clndr/(?P<year>\d+)/(?P<month>\d+)/(?P<day>\d+)/$', views.calendar, name='calendar'), url(r'^(?P<year>\d+)/(?P<month>[-\w]+)/(?P<day>\d+)/(?P<pk>\d+)/$', DateDetailView.as_view(model=Scan, date_field="scan_time"), name="archive_date_detail"), url(r'^today/$', views.ScanTodayArchiveView.as_view(), name="archive_today"), url(r'^(?P<year>\d{4})/(?P<month>\d+)/(?P<day>\d+)/$', views.ScanDayArchiveView.as_view(month_format='%m'), name="archive_day"), url(r'^(?P<year>\d{4})/week/(?P<week>\d+)/$', views.ScanWeekArchiveView.as_view(), name="archive_week"), # Example: /2012/08/ url(r'^(?P<year>\d{4})/(?P<month>\d+)/$', views.ScanMonthArchiveView.as_view(month_format='%m'), name="archive_month_numeric"), # Example: /2012/aug/
from django.conf.urls import url from django.views.generic.dates import DateDetailView from datetime import datetime from dateutil import parser from . import views from .models import Entry def datify(date_time_str): date_time = parser.parse(date_time_str) date_time = date_time.replace(tzinfo=None) received_datetime = datetime.strptime(date_time, '%Y-%m-%d %H:%M:%S') return received_datetime.date() urlpatterns = [ url(r'^/$', views.frontpage, name='frontpage'), url(r'^/post/(?P<year>[0-9]{4})/(?P<month>[0-9]+)/(?P<day>[0-9]+)/(?P<pk>\d+)$', DateDetailView.as_view( model=Entry, date_field='pub_date', month_format=u'%m', ), name='entry_detail'), #url(r'^/post/(?P<pk>\d+)/$', views.entry_detail, name='entry_detail'), url(r'^/post/new/$', views.entry_form, name='entry_form'), ]
from django.conf.urls.defaults import * from django.views.generic.dates import ArchiveIndexView, YearArchiveView, MonthArchiveView, DayArchiveView, DateDetailView from coltrane.models import Link link_info_dict = { 'model': Link, 'queryset': Link.objects.all(), 'date_field': 'pub_date', } # Views for the Link Model urlpatterns = patterns('', url(r'^$', ArchiveIndexView.as_view(**link_info_dict), name='coltrane_link_archieve_index'), url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(make_object_list = True, allow_future = True, **link_info_dict), name='coltrane_link_archieve_year'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', MonthArchiveView.as_view(**link_info_dict), name='coltrane_link_archive_month'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', DayArchiveView.as_view(**link_info_dict), name='coltrane_link_archive_day'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(**link_info_dict), name='coltrane_link_detail'), )
from django.conf.urls import patterns, url from django.views.generic.list import ListView from photogallery.models import Photo from django.views.generic.dates import DateDetailView photo_view_params = {'queryset': Photo.objects.all(), 'date_field': "pub_date"} urlpatterns = patterns('', url(r'^/photogallery/?', 'photogallery.views.render_albums', name='photogallery_list'), url(r'^/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/?$', DateDetailView.as_view(**photo_view_params), name='photogallery_photo_detail'), )
# template_name='household/receipt_archive.html' # ), name='mousy_receipt_archive_index'), #url(r'^receipt/(?P<year>\d{4})/$', YearArchiveView.as_view(queryset = Receipt.objects.all(), # date_field='date', # allow_empty = True, # make_object_list=True, # template_name='household/receipt_archive_year.html' # ), name='mousy_receipt_archive_year'), #url(r'^receipt/(?P<year>\d{4})/(?P<month>\w{3})/$', MonthArchiveView.as_view(queryset = Receipt.objects.all(), # date_field = 'date', # allow_empty = True, # paginate_by = 5, # template_name='household/receipt_archive_month.html' # ), name='mousy_receipt_archive_month'), #url(r'^receipt/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', DayArchiveView.as_view(queryset = Receipt.objects.all(), # date_field = 'date', # allow_empty = True, # paginate_by = 5, # template_name='household/receipt_archive_day.html' # ), name='mousy_receipt_archive_day'), # url(r'^receipt/(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<pk>[\d]+)/$', DateDetailView.as_view(queryset = Receipt.objects.all(), date_field = 'date', template_name='household/receipt_detail.html' ), name='mousy_receipt_detail'), )
from django.conf.urls.defaults import * from models import Entry, Tag from django.views.generic.dates import ArchiveIndexView, DateDetailView from django.views.generic import TemplateView urlpatterns = patterns('', url(r'^/?$', ArchiveIndexView.as_view(model=Entry, date_field="published_on"), name="news-main"), # url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[0-9A-Za-z-]+)/$', 'date_based.object_detail', dict(entry_dict, slug_field='slug', month_format='%m'),name="news-detail"), url(r'^(?P<year>\d+)/(?P<month>[-\w]+)/(?P<day>\d+)/(?P<pk>\d+)/$', DateDetailView.as_view(model=Entry, date_field="published_on"), name="news_detail"), url(r'^about/$', TemplateView.as_view(template_name='news/about.html'), name='news-about'), )
from django.conf.urls.defaults import * from models import Entry, Tag from django.views.generic.dates import ArchiveIndexView, DateDetailView from django.views.generic import TemplateView urlpatterns = patterns( '', url(r'^/?$', ArchiveIndexView.as_view(model=Entry, date_field="published_on"), name="news-main"), # url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[0-9A-Za-z-]+)/$', 'date_based.object_detail', dict(entry_dict, slug_field='slug', month_format='%m'),name="news-detail"), url(r'^(?P<year>\d+)/(?P<month>[-\w]+)/(?P<day>\d+)/(?P<pk>\d+)/$', DateDetailView.as_view(model=Entry, date_field="published_on"), name="news_detail"), url(r'^about/$', TemplateView.as_view(template_name='news/about.html'), name='news-about'), )
paginate_by= 9, allow_empty= True, queryset= Noche.live.all()), name='noche_year'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$', MonthArchiveView.as_view( date_field= 'fecha_evento', month_format = '%m', paginate_by= 9, allow_empty= True, queryset= Noche.live.exclude(fecha_evento__lt=date.today()).reverse(), allow_future = True), name='noche_mes'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', DayArchiveView.as_view( date_field= 'fecha_evento', month_format = '%m', paginate_by= 5, allow_empty= True, queryset= Noche.live.all()), name='noche_dia'), url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view( slug_field = 'slug', date_field= 'fecha_evento', month_format = '%m', allow_future = True, queryset= Noche.live.all()), name='noche-detalle'), )
from django.conf.urls import * from django.views.generic.dates import ArchiveIndexView, YearArchiveView, MonthArchiveView, DayArchiveView, DateDetailView from jraywo.models import Entry urlpatterns = patterns('', url(r'^$', ArchiveIndexView.as_view( queryset = Entry.live.all(), date_field = 'pub_date', allow_empty = True, paginate_by = 5, ), name='jraywo_entry_archive_index'), url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(queryset = Entry.live.all(), date_field='pub_date', allow_empty = True, make_object_list=True), name='jraywo_entry_archive_year'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/$', MonthArchiveView.as_view(queryset = Entry.live.all(), date_field = 'pub_date', allow_empty = True, paginate_by = 5, ), name='jraywo_entry_archive_month'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/$', DayArchiveView.as_view(queryset = Entry.live.all(), date_field = 'pub_date', allow_empty = True, paginate_by = 5, ), name='jraywo_entry_archive_day'), url(r'^(?P<year>\d{4})/(?P<month>\w{3})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(queryset = Entry.live.all(), date_field = 'pub_date', ), name='jraywo_entry_detail'), )
</form> # 通用日期视图 1.所有年份列表 2.某年列表 3.某年的某月列表 4.某年的第几周列表 5.某年某月某天列表 6.当天列表 7.具体详情 # urls.py from django.conf.urls import url from django.views.generic.dates import ArchiveIndexView,DateDetailView from myapp.views import ArticleYearArchiveView,ArticleMonthArchiveView,ArticleWeekArchiveView,ArticleDayArchiveView,ArticleTodayArchiveView urlpatterns = [ url(r'^archive/$',ArchiveIndexView.as_view(model=Article, date_field="pub_date"),name="article_archive"), url(r'^(?P<year>[0-9]{4})/$',ArticleYearArchiveView.as_view(),name="article_year_archive"), url(r'^(?P<year>[0-9]{4})/(?P<month>[0-9]+)/$',ArticleMonthArchiveView.as_view(month_format='%m'),name="archive_month_numeric"), url(r'^(?P<year>[0-9]{4})/week/(?P<week>[0-9]+)/$',ArticleWeekArchiveView.as_view(),name="archive_week"), url(r'^(?P<year>[0-9]{4})/(?P<month>[-\w]+)/(?P<day>[0-9]+)/$',ArticleDayArchiveView.as_view(),name="archive_day"), url(r'^today/$',ArticleTodayArchiveView.as_view(),name="archive_today"), url(r'^(?P<year>[0-9]{4})/(?P<month>[-\w]+)/(?P<day>[0-9]+)/(?P<pk>[0-9]+)/$',DateDetailView.as_view(model=Article, date_field="pub_date"),name="archive_date_detail"), ] # models.py from django.db import models from django.core.urlresolvers import reverse class Article(models.Model): title = models.CharField(max_length=200) pub_date = models.DateField() def get_absolute_url(self): return reverse('article-detail', kwargs={'pk': self.pk}) # views.py from django.views.generic.dates import YearArchiveView,MonthArchiveView,WeekArchiveView,DayArchiveView,TodayArchiveView from myapp.models import Article class ArticleYearArchiveView(YearArchiveView): queryset = Article.objects.all()
url(r'^archive/(?P<year>\d{4})/(?P<month>\d{2})/$', MonthArchiveView.as_view( queryset = Blog.objects.all(), date_field = 'pub_date', month_format = '%m' ), name='blog_archive_index_month'), url(r'^archive/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{1,2})/$', MonthArchiveView.as_view( queryset = Blog.objects.all(), date_field = 'pub_date', month_format = '%m' ), name='blog_archive_index_day'), url(r'^archive/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view( model = Blog, context_object_name = 'blog', date_field = 'pub_date', month_format = '%m' ), name='blog_detail'), url(r'^$', 'ddtcms.blog.views.index',name='blog_index'), url(r'^post/$','ddtcms.blog.views.post'), )
1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin from django.views.generic.dates import ArchiveIndexView,DateDetailView from newapp.views import (AsteroideYearArchiveView, AsteroideMonthArchiveView, AsteroideWeekArchiveView, AsteroideDayArchiveView, AsteroideTodayArchiveView, AsteroideDetailView, ) from newapp.models import Asteroide urlpatterns = [ url(r'^admin/', admin.site.urls), #url(r'^(?P<slug>[-\w]+)/$', AsteroideDetailView.as_view(), name='asteroide-detail'), url(r'^$',AsteroideTodayArchiveView.as_view(),name="index"), url(r'^archive/$',ArchiveIndexView.as_view(model=Asteroide, date_field="fecha"),name="asteroide_archive"), url(r'^(?P<year>[0-9]{4})/$',AsteroideYearArchiveView.as_view(),name="asteroide_year_archive"), url(r'^(?P<year>[0-9]{4})/(?P<month>[0-9]+)/$',AsteroideMonthArchiveView.as_view(month_format='%m'),name="archive_month_numeric"), url(r'^(?P<year>[0-9]{4})/week/(?P<week>[0-9]+)/$',AsteroideWeekArchiveView.as_view(),name="archive_week"), url(r'^(?P<year>[0-9]{4})/(?P<month>[0-9]+)/(?P<day>[0-9]+)/$',AsteroideDayArchiveView.as_view(month_format='%m'),name="archive_day"), url(r'^today/$',AsteroideTodayArchiveView.as_view(),name="archive_today"), url(r'^(?P<year>[0-9]{4})/(?P<month>[0-9]+)/(?P<day>[0-9]+)/(?P<pk>[0-9]+)/$',DateDetailView.as_view(model=Asteroide,month_format='%m', date_field="fecha"),name="archive_date_detail"), ]